On Wed, Sep 14, 2011 at 11:01 PM, Stéphane Ducasse < [email protected]> wrote:
> Hi > > this is early (at least to me) and I was asking myself a probably stupid > question. But I would like to get your smart answers :) > > does a smalltalk like language really need explicit return in []? > As Lukas says, not if one has exceptions. But Smalltalk-80 V2 didn't have exceptions, and so needed ^-return. Personally I find ^-return elegant and a vital part of the language's simplicity. If ^-return is not allowed in blocks then blocks are special-cases, must be explained, and avoided in certain cases, etc. Getting rid of it pushes the language in a more traditional convenient-for-the-language-implementor direction that I think is a serious mistake. Language should serve the author/reader, *not* the implementor. > Q1 When are they absolutely required? > Q2 What replacing mechanisms would be needed? > Q3 What would we gain from an implementation stand point? > Some simplicity, certainly. But (IMO) ^-return isn't as complex as method lookup and message cacheing so you're not reducing complexity overall. > It seems that in resilience lars removed them and more. > Yes, IIRC he got rid of first-class blocks. They can only be downward funargs (passed as parameters), not upward funargs (stored in inst vars, returned as results and hence used after their enclosing activation has returned). > Stef > > for Q1 I see > > foo > x isZero ifTrue: [^ 33]. > self continue > -- best, Eliot
