1. how does value() return an atom??
- Posted by Jerry_Story Mar 02, 2011
- 1543 views
v = value(x)
value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"
2. Re: how does value() return an atom??
- Posted by LarryMiller Mar 02, 2011
- 1528 views
Actually value() always returns a sequence. [http://openeuphoria.org/docs/std_get.html#_2214_value]
3. Re: how does value() return an atom??
- Posted by jaygade Mar 02, 2011
- 1544 views
I think that's what Jerry's trying to say - he's expecting a sequence but getting an atom.
Do you have a larger example?
4. Re: how does value() return an atom??
- Posted by Jerry_Story Mar 02, 2011
- 1503 views
Do you have a larger example?
global function my_value(object x) -- substitute for Euphoria's value() atom a sequence v if atom(x) then a = 0 else v = value(x) if v[1] = GET_SUCCESS then a = v[2] else a = 0 end if end if return(a) end function -- my_value()
The above code always worked before. Now I'm getting this error message:
"type_check failure, v is 7"
It makes no sense to me. How is this possible?
5. Re: how does value() return an atom??
- Posted by DerekParnell (admin) Mar 02, 2011
- 1494 views
v = value(x)
value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"
For what value of x does value() return a 7?
6. Re: how does value() return an atom??
- Posted by Jerry_Story Mar 03, 2011
- 1489 views
v = value(x)
value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"
For what value of x does value() return a 7?
puts(1, "hello ... " & x & "\n")
prints:
hello ... 7
7. Re: how does value() return an atom??
- Posted by DerekParnell (admin) Mar 03, 2011
- 1502 views
v = value(x)
value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"
For what value of x does value() return a 7?
puts(1, "hello ... " & x & "\n")
prints:
hello ... 7
Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?
8. Re: how does value() return an atom??
- Posted by Jerry_Story Mar 03, 2011
- 1493 views
Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?
Yup. But it's supposed to return a sequence.
9. Re: how does value() return an atom??
- Posted by DerekParnell (admin) Mar 03, 2011
- 1501 views
Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?
Yup. But it's supposed to return a sequence.
I know its supposed to return a sequence.
Here is what I get ...
c:\temp>type bug.ex include std/get.e ? value("7") c:\temp>eui bug {0,7} c:\temp>Which seems to saying that its working as expected.
Could it be that you are actually running a different value() function rather than the one in the standard library?
10. Re: how does value() return an atom??
- Posted by Jerry_Story Mar 03, 2011
- 1492 views
Could it be that you are actually running a different value() function rather than the one in the standard library?
Yup that was it. I changed the code as follows:
include std/get.e as stdget -- include std/get.e -- -- v = stdget:value(x) -- v = value(x)
And then the problem vanished.
I found this in Irv's GtkEngine.e.
override function value(object x) -- replacement for Eu's value()
Could that cause the problem? It didn't before.
11. Re: how does value() return an atom??
- Posted by DerekParnell (admin) Mar 03, 2011
- 1475 views
Could that cause the problem? It didn't before.
Before what?
12. Re: how does value() return an atom??
- Posted by Jerry_Story Mar 03, 2011
- 1367 views
Could that cause the problem? It didn't before.
Before what?
The previous time I ran the program. The date on it is November 15, 2010.