[Truth test fails]
[1/7] from: tim::johnsons-web::com at: 18-May-2004 13:53
I'm seeing unexpected behavior from a truth test in a context.
Here is the code for the context:
writer: make object![
keys: [bold size color family]
bold: true
bold-tag: ""
bold-end-tag: ""
fix: func[args[block!]][
foreach [key val] args[
?? key
if not find keys key [
make error!
reform[key "is not an acceptable key for htm-writer. Use:" keys]]
set in self key val
]
?? bold
either bold [
print "creating tag"
bold-tag: "<b>"
bold-end-tag: "</b>"
][
print "no tag"
bold-tag: ""
bold-end-tag: ""
]
]
]
Now here is sample code execution:
>> writer/fix [bold false]
key: bold
bold: false
creating tag
== "</b>"
I would expect that the false-block for 'either
would be executed.
What am I doing wrong?
thanks
tim
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
[2/7] from: lmecir:mbox:vol:cz at: 19-May-2004 0:39
Tim Johnson napsal(a):
>I'm seeing unexpected behavior from a truth test in a context.
>Here is the code for the context:
<<quoted lines omitted: 36>>
>thanks
>tim
see this:
set [key val] [bold false]
probe key
set key val
probe bold ; == false
type? bold ; == word!
-L
[3/7] from: tim:johnsons-web at: 18-May-2004 15:12
* Ladislav Me??í?? <[lmecir--mbox--vol--cz]> [040518 15:01]:
> Tim Johnson napsal(a):
>
> >I'm seeing unexpected behavior from a truth test in a context.
<....> >
> >What am I doing wrong?
> >
<<quoted lines omitted: 8>>
> probe bold ; == false
> type? bold ; == word!
Hah! forgot to use 'get
Thanks Ladislav!
tim
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
[4/7] from: cyphre:seznam:cz at: 19-May-2004 11:48
Hi Tim,
just little notice...sometimes it is useful to know also this this kind of
syntax(although in your case it is better to use get IMO)
>> a: [false #[false]]
== [false false]
>> type? a/1
== word!
>> type? a/2
== logic!
>>
regards,
Cyphre
[5/7] from: tim:johnsons-web at: 19-May-2004 8:21
* Cyphre <[cyphre--seznam--cz]> [040519 02:18]:
> Hi Tim,
> just little notice...sometimes it is useful to know also this this kind of
<<quoted lines omitted: 6>>
> == logic!
> >>
I'll be darned. I didn't realize that one could
do that. What would be the use for that feature?
Thanks
tim
> regards,
> Cyphre
<<quoted lines omitted: 41>>
> To unsubscribe from this list, just send an email to
> [rebol-request--rebol--com] with unsubscribe as the subject.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
[6/7] from: carl:cybercraft at: 20-May-2004 8:28
>* Cyphre <[cyphre--seznam--cz]> [040519 02:18]:
>>
<<quoted lines omitted: 12>>
> I'll be darned. I didn't realize that one could
> do that.
It's only in the beta versions, not in 1.2.1.
> What would be the use for that feature?
Saves the need for a compose, I guess...
a: compose [false (false)]
-- Carl
[7/7] from: Christian:Ensel:GMX at: 20-May-2004 1:36
Hi Tim,
| What would be the use for that feature?
|
It's usefull e.g. when you MOLD or SAVE what you want to LOAD easily:
>> mold none
== "none"
>> mold/all none
== "#[none]"
>> type? load mold none
== word!
>> type? load mold/all none
== none!
>> save/all %/c/test.r none
>> load %/c/test.r
== none
>> type? load %/c/test.r
== none!
The same feature applies for objects, too:
>> mold/all context [a: 5]
== {
#[object! [
a: 5
]]}
>> type? load mold context [a: 5]
== block!
>> type? load mold/all context [a: 5]
== object!
HTH,
Christian
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted