[racket] low level question: why begin0?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Apr 29 18:20:57 EDT 2012

Oh yes, that was it.

Robby

On Sun, Apr 29, 2012 at 5:14 PM, Ryan Culpepper <ryan at cs.utah.edu> wrote:
> I think the point of 'begin0' is that it handles multiple values efficiently
> (ie, more so than a heap-allocated list). The expansion of 'begin0' would
> have to be something like
>
> (call-with-values (lambda () e1)
>  (lambda result (begin e2 (apply values result))))
>
> since in general the number of values produced by e1 is not known at
> expansion time.
>
> Ryan
>
>
>
> On 04/29/2012 03:54 PM, Sam Tobin-Hochstadt wrote:
>>
>> Presumably we could remove it from fully-expanded code and then the
>> compiler could re-transform this:
>>
>> (let ([x e]) e0 ... x)
>>
>> into some bytecode that uses begin0, which would simplify the job of
>> tools that process expanded code without changing performance.
>>
>> On Sun, Apr 29, 2012 at 5:07 PM, Robby Findler
>> <robby at eecs.northwestern.edu>  wrote:
>>>
>>> We debated this long ago and I think the conclusion was that we could
>>> get a little more performance by including it at the bytecode level
>>> that seemed worth having (the precise details (like if we had a
>>> program where that mattered) escape me).
>>>
>>> Robby
>>>
>>> On Sun, Apr 29, 2012 at 1:03 PM, Danny Yoo<dyoo at cs.wpi.edu>  wrote:
>>>>
>>>> One question that I had stowed away a long time ago: why is begin0
>>>> part of the language?  It seems redundant in the face of having 'let'
>>>> to capture a value that we want to return at the end of some sequence.
>>>> ____________________
>>>>  Racket Users list:
>>>>  http://lists.racket-lang.org/users
>>>
>>>
>>> ____________________
>>>  Racket Users list:
>>>  http://lists.racket-lang.org/users
>>
>>
>>
>>
>


Posted on the users mailing list.