[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple values in Dylan

    Gack. You've given multiple-value-call semantics to ALL procedure 
    calls.  I certainly never intended to propose anything like that! 
    According to what I was suggesting, the form 
        (cons (foo a) (bar b) (bletch c)) 
    is DEFINITELY erroneous, because an expression that is 
    a procedure-argument must produce exactly one value. That's why I 
    said that
        (+ (floor a) b)
    was also wrong, because FLOOR didn't produce one value.
Hmm...  I guess I did misunderstand your proposal then.  It seemed to me
that when you said "all the returned values are passed as arguments to the
current continuation, no more, no less" you meant that this works like
multiple-value-call.  Now we see that only single-return-value functions
are allowed in procedure arguments. and that multiple values are allowed
only in certain special forms.  Functions of 0 values would presumably be
allowed within things like BEGIN blocks, where the values are discarded
anyway.  Would functions of one value be allowed there as well?  That's

What this does is break the Dylan world down into two or three distinct
kinds of functions: one-valued, multi-valued, and (perhaps a separate
class) zero-valued.  For those functions, built-in and user defined, where
there is a primary return value and several less-useful ones, you would
have to define two versions of each.  I would argue that, for built-in
functions, the good names should go to the more commonly used single-value

So it seems to me, if I now understand the proposal, that what you've done
is to ghettoize the MV versions.  They can only be used if both the caller
and the callee specifically use the MV machinery, and it's an error if they
don't agree.  I much prefer the model in which the caller decides how many
values it wants, and the callee just returns everything that might be
useful.  This makes the called function more generic: you can call it for
one value or for many.

-- Scott
Scott E. Fahlman			Internet:  sef+@cs.cmu.edu
Senior Research Scientist		Phone:     412 268-2575
School of Computer Science              Fax:       412 681-5739
Carnegie Mellon University		Latitude:  40:26:33 N
5000 Forbes Avenue			Longitude: 79:56:48 W
Pittsburgh, PA 15213