I apologise for the delay in responding; I was incommunicado for a few
days.
Steve Wampler <[EMAIL PROTECTED]> wrote:
>On Fri, 2004-02-06 at 07:20, Michael Borek wrote:
>
>>
>> Please note that I wasn't suggesting that call-by-parameter-name be
>> included now! I just wish to point out that using '=' or ':=' would
>> require a syntax change should call-by-parameter-name ever be implemented.
>
>Why? They are different beasts both lexically and semantically. There
>would be no need to change the syntax of default value definition were
>call-by-parameter-name ever be added.
I was initially confused by the statement of them being "different
beasts", but reading the other posts led me to conclude (infer) that
it was a matter of viewpoint, both of which are valid.
One (my original) view is that it is a matter of giving a parameter
a value; the default just being what to use if it is not indicated
otherwise by position or CBPN. It follows that CBPN is just a side
effect of not using position rather than a significant distinction.
The other view is that of seeing default value specification in
procedure declaration separately from parameter assignment in
procedure calls.
The former view implies that the syntaxes should be similar; the
latter does not (and lends credence to the statement that they
should not be).
The only sure way to identify which is best is to measure programmer
error/confusion rates on each notation statistically. Perhaps an
undergarduate project in cognitive psychology :^)
Also: ':=' can be used in both cases:
declaration: f(x : integer := gp := 1) where gp is a (package) global
call f(x := gp := 2) where gp gets assigned 2 as does x.
I just thing itthat is a *little* more confusing.
> ... I guess I don't see much difference between:
>
> procedure foo(x:=1)
>
>and
>
> procedure foo(x)
> /x := 1
>
>(especially since they are symantically identical - so sharing a common
>syntax seems pretty reasonable).
The only real difference is that 'x' has a binding and value
(which may be &null) in the second case, as indicated by being able
to use '/'.
>
>I happen to like the idea of "=>" for call-by-parameter-name, even
Thank you (although I was not the first ;^)
>if I'm not particularly enthused about the basic idea itself!
It is not as useful as default values, I agree, but it does
eliminate counting lots of commas in procedures with many values!
>> + (As a side note, Ada also allows one to create a procedure which is
>> + the same as another with some of the parameters filled in:
>>
>> + f(x, z) = g(x, y => 5, z) (NB: not the true Ada notation!)
>
>Is this what is typically called a 'closure' in older languages? It's
It's not a (new) closure because the 'y' is already closed within the
procedure.
>an intriguing idea, but what are the advantages over (in Unicon):
>
> procedure f(x,z)
> suspend g(x,5,z)
> end
>
>(other than saving a some typing)? A small performance gain,
You mean much the same as default values?^) It also assists in
focusing the readers attention on the important and changing aspects
of the code. If available dynamically (rather than statically
compiled within the code), one can do things like:
while val := <expression> do {
g := f(x, y => val, z)
:
<use g(x1, z1)>
:
<use g(x2, z2)>
:
}
or pass g transparently to other procedures expecting two parameters.
>
>Anyway, I've seen several proposals for type+default value declarations
>that I'd be happy with. Maybe we should let Clint's group pick one and
>put it in so the current oddities about trying to specify structured
>types for parameters can be fixed - which is what I'm personally
>concerned about.
I most heartily concur!
Michael Borek
"Death before Dishonour; Beer before Lunch"
__________________________________________________________________
New! Unlimited Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Act now to get a personalized email address!
Netscape. Just the Net You Need.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group