Re: [stack] Parameters: ordered versus named

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
Don Groves <[email protected]> wrote:
> I believe it was sci-fi writer Robert Heinlein who coined the phrase,
> "There ain't no such thing as a free lunch."

Possibly -- that's where I read it too.

> The price we pay for the
> simplicity of
> concatenative syntax is the amount of parameter checking we must do at
> run-time which other languages to at compile-time.

Not true. Concatenative semantics don't require parameter passing, so
there is nothing to do to parameters at runtime. There are, of course,
other prices we must pay; but that's not one of them.

> The parametric details in DEFINE foo (int x, char y,void *z), etc.
> are explicit
> whereas they are implicit in DEFINE foo = ...dup...swap, etc. To give

There are concatenative languages that require explicit type
specifications; Cat, Factor, and strongForth are three very different
examples. In general, most strongly statically typed concatenative
languages have defined a syntax something like this

"DEFINE foo ( int char pointer-to-void -- int )". The syntax is
similar to Forth's classical stack diagrams.

> a truly
> realistic picture of a concatenative foo, shouldn't we also give its
> stack effect, as in this for map:
> [a b ...] [f] map ==> [af bf ...] (where xf denotes the application
> of f to x)

We definitely should -- it's a good habit, even if the language you're
using doesn't use static types, you should put that in a comment.

> One beauty of concatenative notation is the hiding of information
> such as described here,

Nothing's hidden.

> but we all know that hidden info must be dealt with
> eventually,
> unless the language is so primitive as to not care about these matters.

But this is true. (Well, mostly -- Cat does type inferencing so you
don't always have to describe the types, while Enchilada defines its
semantics so that all its types are compatible.)

> Don Groves

-Billy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.