Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!daffy!uwvax!sinetnews!news.u-tokyo.ac.jp!wnoc-tyo-news!nirvana.cs.titech!cs.titech!is.titech!wakita
From: wakita@is.titech.ac.jp (WAKITA Ken)
Subject: Re: Two questions (mutiple values, array index bounds)
In-Reply-To: ddemars@msmail4.hac.com's message of Tue, 22 Nov 1994 12:51:00 -0800
Message-ID: <WAKITA.94Nov25125558@lime.is.titech.ac.jp>
Sender: news@is.titech.ac.jp (Usenet News System)
Organization: Dept. Mathematical and Computing Sciences,
References: <ddemars-2211941251000001@demars.es.hac.com>
Date: Fri, 25 Nov 1994 03:55:58 GMT
Lines: 54


>>>>> On Tue, 22 Nov 1994 12:51:00 -0800, ddemars@msmail4.hac.com (Dennis C. De Mars) said:
> NNTP-Posting-Host: demars.es.hac.com

> 1) Why can't multiple values be used in assignment statements?

> As far as I can see, functions returning multiple values can appear when
> initializing module variables or lexical variables, but not in
> assignments to either kind of variable. This concerns me for several
> reasons.

Going this way further, you may want to have the following extended
syntax, also:

select (values(a, b))
  (1, 2) => body;
  ...
end select

The problem you pointed out involves not only syntactic but also
semantical problem: the meaning of multiple values are considered its
first item in other place than the binding form, losing other values
of the multiple values.  For instance,

? define variable a = values(1, 2);
? a;
1
? object-class(a);
{the class <integer>}

With this semantics, the expression (a, b, c) := values(1, 2, 3) is
intepreted in the first place as (a, b, c) := 1, where assignment to
multiple values does not make sense.  The similar occurs with my
extended select statement, too.

It may be possible to change Dylan semantics a bit to treat multiple
values as first class object (multiple values retain their multpleness
outside the binding expressions) and have our extended syntax.  I
prefer this approach for its cleanliness. In this case, we would need
a way to express useless values with, such as _ with Standard ML:

(a, _, c) := MultipleValuesFunction();

However, I also think there might be a good reason from the practical
point of view with respect to multiple values design of Dylan.  Or
maybe influence from CommonLisp tradition?  I cannot remember how
multple values are treated in the Scheme R5RS proposal.

--
WAKITA Ken (wakita@is.titech.ac.jp)
Department of Mathematical and Computing Sciences,
Tokyo Institute of Technology
2-12-1 Oh-okayama, Meguro-ku, Tokyo, 152, Japan
TEL: +81-(0)3-5734-3228, FAX: +81-(0)3-5734-2754
