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

Re: [Scheme-reports] multiple values module



On 05/24/2011 11:54 AM, Aaron W. Hsu wrote:
> On Tue, 24 May 2011 13:04:21 -0400, Emmanuel Medernach
> <emmanuel.medernach@x>  wrote:
>
>> Indeed, but in (foo X Y) I would not allow the evaluation of expression
>> X to interfere with Y : if X is (values X1 X2) and Y is (values), foo
>> could mislead X1 with X and X2 with Y as in some implementation. I mean
>> doesn't the report has to specify that evaluation of X has to be bound
>> to X only ?
>
> Indeed, how many implementation contain this semantics? Is it a semantics
> that is justified or should we clarify the language to not permit values
> passed to one continuation to "infect" another continuation? I'm of a mind
> that this sort of requirement would be a good thing.

I think the above semantics does make for a powerful and useful language.
The XQuery language has shown the power of using "sequences", which are
like lists, except they don't nest, and a sequence of length 1 is equivalent
to the single item in that list.  Note this is similar is multiple values,
in that (values x)===x.  If you combine that with the idea of function
application taking a sequence of values, then you get some neat synergies.
In my Q2 language I've been playing with these ideas.

My biggest concern with such a semantics is how error-prone this would be:
Such semantics might easy hide programmer errors and confusion.  Inlining
and other optimization might be also be more difficult.  Both of these
concerns should be less in a language with some kind of static 
type-checking,
but for a traditional Scheme it's probably not a good idea.

Still, I think it's an interested concept, worth exploring - but in the
context of designing a new sequence-based language, not Scheme.
-- 
	--Per Bothner
per@x   http://per.bothner.com/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports