SYMBOL: can be used anywhere, but you'll notice that if you define it
within the M:, it's still available on the outside. It's generally
considered contrary to coding conventions to put SYMBOL: within a word
body, since it means the same thing as if it's outside of the word
body.

Dan

On Mon, Jan 12, 2009 at 9:11 AM, Ludovic Kuty <mail...@kuty.be> wrote:
> It looks like SYMBOL: can be used anywhere. Thus my example becomes:
>
> M: rectangle area
>    SYMBOL: temp
>    temp [ temp get width>> temp get height>> * ] with-variable ;
>
> And in fact "\ temp" has no meaning if temp is not defined somewhere.
> That's why "\ +" works but not "\ not_defined". The documentation for
> DEFER: states that "Due to the way the parser works, words cannot be
> referenced before they are defined".
>
> That answers my second question. However I'm not sure this is the
> correct way to express access to multiple slots.
>
> On 12 Jan 2009, at 15:55, Ludovic Kuty wrote:
>
>> I thought of doing like this:
>> SYMBOL: temp
>> M: rectangle area
>>    temp [ temp get width>> temp get height>> * ] with-variable ;
>>
>> But now I have an implementation detail (the fact that temp is a
>> symbol) that is leaking out of the method body. It doesn't feel right.
>> I should be able to avoid SYMBOL and use "\ temp" but Factor curiously
>> complains: "Word not found in current vocabulary search path". The \
>> parsing word should avoid trying to execute the word. Any idea are
>> welcome.
>
>
> ------------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to