name of var passed to func
[1/9] from: mikew127::hotmail::com at: 2-Dec-2000 14:44
I'm trying to set a quick debug function that I can throw in where ever I'm
having trouble.
first I have this:
>> x: 5
== 5
>> print join 'x join " = " x
x = 5
then I wrote:
>> debug: func [a b] [print join a join " = " b]
>> debug 'x x
x = 5
All well and good but the key word here is quick and I type slow.
What I want is:
debug x
I write:
>> debug: func [a] [print join 'a join " = " a]
>> debug x
a = 5
How do I get 'x out of a?
This may not seem like much until you see the difference between:
debug some_really_long_variable_name
and
debug 'some_really_long_variable_name some_really_long_variable_name
-bobo
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
[2/9] from: lmecir:mbox:vol:cz at: 2-Dec-2000 16:19
Hi,
debug: func [a] [print join a join " = " get a]
Regards
Ladislav
[3/9] from: mikew127:hot:mail at: 2-Dec-2000 15:48
Ladislav-
I gave that a try and got:
>> x: 5
== 5
>> debug: func [a] [print join a join " = " get a]
>> debug x
** Script Error: get expected word argument of type: any-word.
** Where: print join a join " = "
-bob
>Hi,
>debug: func [a] [print join a join " = " get a]
<<quoted lines omitted: 52>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
[4/9] from: lmecir:mbox:vol:cz at: 2-Dec-2000 17:22
Hi bob,
like this:
>> x: 5
== 5
>> debug 'x
x = 5
Regards
[5/9] from: mike:yaunish:home at: 2-Dec-2000 9:38
At 03:48 PM 02/12/00 +0000, you wrote:
Try:
>> debug: func [ 'a ] [ print [ a "=" get a ] ]
>> x: 5
== 5
>> debug x
x = 5
>Ladislav-
>I gave that a try and got:
<<quoted lines omitted: 71>>
>To unsubscribe from this list, please send an email to
>[rebol-request--rebol--com] with "unsubscribe" in the subject, without the quotes.
Mike Yaunish
[mike--yaunish--home--com]
[6/9] from: mikew127:hotma:il at: 2-Dec-2000 18:29
Ladislav-
Mike-
>> x: 5
== 5
>> debug: func [a] [print join a join " = " get a]
>> debug 'x
x = 5
>> debug: func ['a] [print join a join " = " get a]
>> debug x
x = 5
I like it!
Thank you both.
-bobo
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
[7/9] from: al:bri:xtra at: 3-Dec-2000 9:21
> I'm trying to set a quick debug function that I can throw in where ever
I'm having trouble.
>> x: 5
== 5
>> help x
X is an integer of value: 5
>> ? x
X is an integer of value: 5
Andrew Martin
Rebol nut...
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[8/9] from: allenk:powerup:au at: 3-Dec-2000 10:29
If just want a quick debug function have you explored using the ?? function
>> a: 4
== 4
>> ?? a
== a: 4
>> b: "hello"
== "hello"
>> ?? b
b: "hello"
Cheers
Allen K
[9/9] from: ingo:2b1 at: 2-Dec-2000 23:58
Let me add this one ...
>> x: 5
== 5
>> ?? 5
(integer): 5
== 5
>> ?? x
x (integer): 5
== 5
>> source ??
??: func [
{
Prints a variable name followed by its type and molded value. (for debugging) *PATCHED*
(iho) added type output
}
'name
][
print either word? :name [
either value? name [
rejoin [name " (" type? get name "): " mold name: get name]
] [
rejoin [name " (no value)"]
]
] [
rejoin ["(" type? :name "): " mold :name]
]
:name
]
>>
hope that helps,
Ingo
Once upon a time Andrew Martin spoketh thus:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted