Hi,

>> a: make object! [ blk: [print 'Hi] set 'f func [] [do blk]]
>> f
Hi
>> source f
f: func [][do blk]

The little bit above is an actual cut and paste from a fresh REBOL/Command 
console on Linux RedHat 7.2  if you actually get something different 
somewhere else please let us know.  
        I don't see what you are talking about, I didn't see any lost code.   Source 
delivered to you EXACTLY what you asked for, the very source of 'f.  What is 
the difference between the example above and the example below? (again this 
is from a fresh console)

>> set 'f func [] [do blk]
>> blk: [print 'Hi]
== [print 'Hi]
>> source f
f: func [][do blk]
>> f
Hi

basically nothing.  In the previous example the Global word 'f was set when 
the spec block of 'a was evaluated by 'make.  In this example f was set at 
the commandline.  The reason that 'f does the value of a/blk in your example 
is because 'f was created in the *context* of a, or in other words the words 
within the 'a object are *local* to 'f.  I am not sure what you were 
expecting to see when you typed "source f" at the commandline, but you saw 
the actual source of 'f.  
        That said, I think that what you are refering to is the fact that when you 
pass a block to make as you did in your example the block is evaluated and 
any commands given are done, any values that are not assigned to words with 
in the spec block are lost for example.

>> a: make object! [
[    print "making a" ; this line will be lost
[    a: does [print "making a"] ;this will not
[    ]
making a
>> source a
a:
make object! [
    a: func [][print "making a"]
]
>> mold a
== {
make object! [
    a: func [][print "making a"]
]}
>> form a
== "?object?"
>> probe a

make object! [
    a: func [][print "making a"]
]


Do you see what I am saying?  SOURCE will even give you the the very SOURCE 
of an Object!  (something I wasn't fully aware of)  Go ahead, use the SOURCE 
faithfully it.   It will not fail you LUKE!

HTH
Ammon

PS thanks to your post, I found that you can create a global word that has a 
context different than the global context without using 'bind!  Enjoy!!


A short time ago, Ingo Hohmann, sent an email stating:
> Now answering my own email ...
>
> Ingo Hohmann wrote:
> > Ammon Johnson wrote:
> >>  Use the SOURCE, Luke!  The SOURCE will not fail you... ;-)
> >
> > Unless it does, of course ...
> >
> >    >> a: make object! [ blk: [ print "HI" ] set 'f func [][ do blk ]]
> >    >> f
> >
> >    HI
> >
> >    >> source f
> >
> >    f: func [][do blk]
> >
> >    >> blk
> >
> >    ** Script Error: blk has no value
> >    ** Near: blk
>
> Of course, given Rebols inspection abilities, you _can_ get to the source:
>  >> second :f              ; gives you the functions body
>
> == [do blk]
>
>  >> second second :f       ; the second element in the function body
>
> == blk
>
>  >> get second second :f   ; and, at last, the value of 'blk
>
> == [print "HI"]
>
>
> Sometimes you need to dig a little ...
>
> Kind regards,
>
> Ingo
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to