Re: [stack] Parameters: ordered versus named

Don Groves <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Sep 7, 2007, at 19:06 , Manfred Von Thun wrote:

...

> In concatenative languages there are no formal parameter
> lists. Definitions look like this:
>
> DEFINE foo                        # head of definition
>   =  ...dup...swap... pop...   # body of definition
>
> Instead of  being able to refer to the actual parameters
> by the name of the corresponding formal parameter,
> it is now necessary to take the actual parameters as
> they are on the stack, and do some shuffling to get
> everything right in the body. Once you have written the
> entire definition, you cannot just change the parameter
> list because there isn’t one. You also have to change the body of
> the definition.

I believe it was sci-fi writer Robert Heinlein who coined the phrase,  
"There
ain't no such thing as a free lunch." 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.

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  
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)

This makes it explicit that map must ensure the stack contains at  
least two
parameters, that they are lists, and that xf makes sense for each x.

One beauty of concatenative notation is the hiding of information  
such as
described here, 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.
--
Don Groves



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/concatenative/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/concatenative/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
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.