Last active
December 26, 2017 17:11
-
-
Save lepinekong/842ae0b54414d44e806da2ffe770493f to your computer and use it in GitHub Desktop.
??
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
??: func [ | |
"Prints a word and the value it refers to (molded)" | |
'value [word! path!] | |
'comment [word! string! unset!] | |
][ | |
switch/default type?/word get/any 'comment [ | |
unset! [ | |
prin mold :value | |
prin ": " | |
print either value? :value [mold get/any :value] ["unset!"] | |
] | |
word! string! [ | |
prin mold :value | |
prin ": " | |
print rejoin [either value? :value [mold get/any :value] ["unset!"] " " mold comment] | |
] | |
][ | |
] | |
] | |
f: func[][ | |
test: "test" | |
?? test "comment" | |
] | |
f | |
f: func[][ | |
test: "test" | |
?? test | |
g: func[][] | |
] | |
f | |
>> f | |
*** Script Error: ?? does not allow set-word! for its 'comment argument | |
*** Where: ?? | |
*** Stack: print f ?? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment