RE: [stack] Overview of Joy (was Concatenative Languages: a New M ailing List)

wtanksley@bigfoot.com — 2000-05-08 19:56:29

From: peter_easthope@...

>"iepos" (Brent Kerby) said,
>bk> I'm guessing they mean that there is no _dynamic_ environment
>bk>of name-value pairs.

>A little further on in the overview is this example.

>square == dup +

>Isn't this the dynamical creation and naming of a function
>to square a number.

No, it's a (static) declaration. Declarations are implicitly static; they
are supposed to behave as though the programmer were declaring a fact about
an already-existing function.

>Another question: Joy says it uses postfix notation. Why is the
>above definition not this way.
> dup + square ==

Good question! The main answer is that in Joy, definition is not part of
the language; it's an external syntax which behaves differently. The
purpose for this is to make it easier to prove things about the language
itself: if the language doesn't support adding definitions, then theorems
about the language don't have to take into account the possibility of the
system dictionary being modified.

Of course, I also have to note that your syntax is impossible; the way you
have it written, the language would have to execute 'square' before it's
defined. If you want to have a word which defines other words, its use
would look something like:

[dup *] "square" define

>Thanks, Peter E.

-Billy