Re: [stack] initial stab at a wikipedia entry
"pml060912" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], John Nowak <john@...> wrote: > > > On Jan 2, 2009, at 9:50 AM, William Tanksley, Jr wrote: > > > Not true -- a variable can be modeled (loosely) as an implicit > > function of time. Forth provides local and global variables; locals > > seem to make a language less concatenative, while globals don't hinder > > it so much. (Naturally, globals have other problems.) > > Global variables can be treated as functions that read/write some > state that gets passed through the program thanks to the monoidal > nature of things. Local variables cannot; their scopes are local and > hence you can't factor out code that references a local variable. The > only way of explaining locals is in terms of substitution. > > I'm not sure if you think my explanation above rules out locals. Well... In a Forth without local variables, you can easily "roll your own" with globals A and B by putting code like this into a wrapper secondary:- A @ >R B @ >R some work R> B ! R> A ! A and B are globals that have been given a local scope. I don't known if this would meet your criteria (and yes, I know why it's poor style - this only goes to whether it can be done).