what about this one?
[1/4] from: petr::krenzelok::trz::cz at: 6-Jul-2001 18:31
Hi,
->> value? 'name
== false
->> user: context [name: "Petr"]
->> value? 'name
== false
->> value? 'user/name
== true
->> value? 'user/lastname
== true
Could anyone elaborate please? :-) The only one method which came to my mind
was:
->> error? try [get in user 'lastname]
== true
Cheers,
-pekr-
[2/4] from: jeff:rebol at: 6-Jul-2001 9:30
Howdy, Petr:
> ->> value? 'name
> == false
<<quoted lines omitted: 6>>
> == true
>> in user 'lastname
== none
-jeff
[3/4] from: agem:crosswinds at: 6-Jul-2001 22:31
RE: [REBOL] what about this one?
[petr--krenzelok--trz--cz] wrote:
> Hi,
> ->> value? 'name
<<quoted lines omitted: 10>>
> ->> error? try [get in user 'lastname]
> == true
[user: context [
name: noname: "Petr" unset 'noname
]
? user
]
USER is an object of value:
make object! [
name: "Petr"
noname: unset
]
[probe value? probe in user 'name]
name
true
[probe value? probe in user 'noname]
noname
false
[probe value? probe in user 'lastname]
none
true
but why? ;-)
> Cheers,
> -pekr-
-Volker>
[4/4] from: rotenca:telvia:it at: 7-Jul-2001 0:42
<[agem--crosswinds--net]>
> > ->> user: context [name: "Petr"]
> > ->> value? 'name
<<quoted lines omitted: 3>>
> > ->> value? 'user/lastname
> > == true
Every path, taken as a lit-word, give true:
>>value? 'foo/bar
==true
Value? does not try to see if "foo" in the path is a defined word.
>>value? 'foo
==false
Now Value? try to see if "foo" is a defined word (it isn't).
A bug or a undocumented feature about path?
Paths, i know, are not word and are interpreted in a different way. Many
functions can't reduce a path to the target word and needs the use of IN.
But IN return None if the word doesn't exist in the object context. So the
return of IN is not the best for Value? because None has a value (itself). A
limit case is this:
>> k: context [none: 'none]
>> in k 'none
== none
What does it mean? None doen't exist in the context or exists a word called
None?
We can check it with Type? which return none! or word! in the two situation.
> [probe value? probe in user 'noname]
> noname
> false
Noname has not value, IN return "noname", which has no value, so false is ok.
> [probe value? probe in user 'lastname]
> none
> true
Lastname does not exist in user, IN return None, None has a value (itself), so
Value return true and is OK.
ciao
romano
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted