Re: [stack] Parameters: ordered versus named

Rodney D Price <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
This classification confuses me a bit.  Are we talking about compile  
time
or run time?  There are lots of evaluation strategies that occur at  
run time;
see http://en.wikipedia.org/wiki/Call_by_name for a nice summary.  Given
that the code, whether written out as function calls with parameters  
called
out by name or by position, compiles to one of the run time behaviors
listed in the article above, what difference does it make whether the  
syntax
calls out the parameters by name or by position?  That syntax  
question is
independent of the semantics question about evaluation strategies.

So which is it?  Syntax or semantics?

-Rod



On Sep 7, 2007, at 8:32 AM, John Cowan wrote:

> Manfred Von Thun scripsit:
>
> > My understanding is that there are some languages which
> > allow this kind of notation (Common Lisp ?, Ada ?) but
> > I cannot remember any details --- anyone??
>
> Common Lisp (as well as some other Lisps such as DSSSL and Dylan)
> does indeed allow keyword arguments. They must physically follow
> the positional arguments (if any) both in declarations and in calls.
> It is also possible to capture unknown keyword arguments for analysis
> at runtime.
>
> In certain domains keyword arguments are used by default. For example,
> CL object constructors are normally keyword-based: you specify the
> fields of a class by name, and the default constructor will accept
> keyword arguments that initialize the fields. (It's also possible to
> write non-default constructors that work like ordinary functions, by
> order of arguments -- these are known as BOA constructors.)
>
> Python has a unified model: parameters are declared by name, and calls
> may use keywords, but non-keyworded arguments are assigned  
> positionally.
> However, in calls non-keyword arguments must precede keyword ones.
> Again, it is possible to capture unknown keyword arguments.
>
> Ada also has a unified model, but there are no constraints on ordering
> in calls, and there is no provision for unknown keywords. Fortran 90
> and 95 also use this model.
>
> Lua provides modest syntactic sugar for keyword-only calls: this is
> declared as a single argument representing a table mapping keywords
> to their values, so all analysis must be done at run time. In Perl,
> there is no special sugar, but passing a hash is common.
>
> Algol 60 allowed calls of the form:
>
> multiply(x) by: (y)
>
> but this meant the same as "multiply(x, y)" and the keywords had no
> significance to the compiler.
>
> Smalltalk is keyword-only, as has been pointed out, except in the  
> cases of
> unary operators (postfix) and binary operators (infix). Binary  
> operators
> are syntactically restricted to use symbol characters only.
>
> -- 
> John Cowan http://ccil.org/~cowan [email protected]
> SAXParserFactory [is] a hideous, evil monstrosity of a class that  
> should
> be hung, shot, beheaded, drawn and quartered, burned at the stake,
> buried in unconsecrated ground, dug up, cremated, and the ashes tossed
> in the Tiber while the complete cast of Wicked sings "Ding dong, the
> witch is dead." --Elliotte Rusty Harold on xml-dev
>
> 



[Non-text portions of this message have been removed]
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.