On Wed, Aug 25, 2010 at 03:24:03AM +0300, Nikhilesh S wrote:
> Preceding a name with '$' will create a variable with that name and pop
> and assign the last thing on the stack to it. Simply a name will push
> the value of the variable with that name onto the stack (if it's not
> executable, we're getting to executables soon).
>
> 3 $var 2 5 var + print # prints '8', 2 is left on stack
Personally, I don't think that a special syntax for variable
definition fits well in a stack-based language. I prefer the
PostScript syntax of quoting the word and using the def keyword,
so:
2 $var def
or
{ 'hi' print } $foo def
or the reverse, or another quoting character. It could also
replace &foo to push a block onto the stack, since executing the
quoted word would be equivalent to executing its associated
block.
-- Kris Maglione Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. --Bertrand MeyerReceived on Wed Aug 25 2010 - 20:26:44 CEST
This archive was generated by hypermail 2.2.0 : Wed Aug 25 2010 - 20:36:02 CEST