Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!newsflash.concordia.ca!news.nstn.ca!ott.istar!istar.net!van.istar!west.istar!n1van.istar!van-bc!news.rmii.com!newsjunkie.ans.net!newsfeeds.ans.net!news-m01.ny.us.ibm.net!news.biu.ac.il!discus.technion.ac.il!news!qobi
From: qobi@eesun.technion.ac.il (Jeffrey Mark Siskind)
Subject: Re: Multiple values and conditionals
Reply-To: Qobi@EE.Technion.AC.IL
Organization: Technion, Israel Institute of Technology
Date: Tue, 23 Jul 1996 12:52:35 GMT
Message-ID: <QOBI.96Jul23155235@eesun.technion.ac.il>
In-Reply-To: shriram@europa.rice.edu's message of 21 Jul 1996 04:48:11 -0500
X-Nntp-Posting-Host: eesun.technion.ac.il
References: <j7v3f2mlyxw.fsf@europa.cs.rice.edu>
Sender: news@discus.technion.ac.il (News system)
Lines: 39

In article <j7v3f2mlyxw.fsf@europa.cs.rice.edu> shriram@europa.rice.edu (Shriram Krishnamurthi) writes:
   Has there been any thought given to integrating multiple values and
   conditionals?  Ashley and Dybvig's paper [LFP 94] says that the result
   of returning multiple values to a single-value context -- eg,

     (if (values 1 2) x y)

   -- is unspecified.

   If multiple values were allowed in conditional slots, then it would be
   nice to see the => extension of cond also updated appropriately.
   Though R4RS says the recipient of a => must be a procedure of one
   argument, this would no longer be a reasonable restriction.  E.g.,

     (cond ((values 1 2) => +))

   should produce 3 (one might expect any extended treatment of
   conditionals would make (values 1 2) be true).

Multiple values should not be part of Scheme, or any lannguage, plain and
simple. They are not first class. There is nothing that multiple values can do
that can't be done by first class aggregate objects like lists, vectors,
tuples, or records. There are two (invalid) motivations for including multiple
values in the language spec: efficiency and call/return symmetry. Efficiency
should be handled by having the compiler detect and optimize the special case
of a procedure creating an aggregate object solely to return multiple values
to its caller. And because expressions are trees, and not dags, there is
inherent call/return asymmetry. That's life. There is nothing you can do about
it.

I used to use multiple values heavily on Symbolics machines for efficiency
purposes. And I got bitten really bad by this practise. I posted a long
message to comp.lang.scheme a while back giving a very detailed argument why
multiple values are a BAD SOFTWARE ENGINEERING PRACTICE because they DESTROY
THE ABSTRACTION BOUNDARIES AND MODULARITY OF PROGRAMS. If you would like I can
repost my article.
-- 

    Jeff (home page http://tochna.technion.ac.il/~qobi)
