[Pharo-dev] Closure vs BlockClosure

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 17 12:54:37 EDT 2014


Hi Alexandre,


On Thu, Apr 17, 2014 at 8:21 AM, Alexandre Bergel
<alexandre.bergel at me.com>wrote:

> Because what we call a block is actually a closure. Smalltalk-80 invented
> blocks, which were not closures at that time. Over the time we found out
> that Blocks are not really useful, but instead the humanity largely prefer
> closure.
>

I don't think this is right.  Yesterday Clément and I had lunch with Dan
Ingalls and we talked about the origin of blocks.  At first blocks were not
even real objects; instead they were just a syntactic construct for delayed
evaluation.  Over time the original Smalltalk team found they needed more
and more useful features, and they wanted everything to be objects so they
introduced both the syntax for blocks and the class BlockContext, but they
didn't look at other languages and so they didn't implement blocks as
closures.

So I think its more accurate to say
   Over time Smalltalkers found blocks were /really/ useful.  Later on they
found out that they could implement blocks as closures, with the result
that they were even more useful and much cleaner, leading to a more
efficient virtual machine.

But ok, this is not a pressing thing. Was just a tough.
>

If it ain't broke don't fix it.  The name BlockClosure isn't incorrect.
 These are blocks implemented as closures.  The name MethodContext /is/
broken.  These /aren't/ just MethodContexts any more, they are both
BlockContexts and MethodContexts, so collapsing ContextPart and
MethodContext together into just Context, and deleting the now unused
BlockContext does make sense.

[snip]

>
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> On Apr 17, 2014, at 11:45 AM, Yuriy Tymchuk <yuriy.tymchuk at me.com> wrote:
>
> > It’s like saying that we have to run Pharo on JVM because everyone is
> doing that. In 80s block was invented. Why should we rename it because of
> some other languages?
> >
> > Uko
> >
> > On 17 Apr 2014, at 16:35, Alexandre Bergel <alexandre.bergel at me.com>
> wrote:
> >
> >> Well… the whole community of programming language call a closure a
> closure. Calling a block what is actually a closure may not be a
> well-marketed move in my opinion.
> >>
> >> Alexandre
> >> --
> >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> >> Alexandre Bergel  http://www.bergel.eu
> >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> >>
> >>
> >>
> >> On Apr 17, 2014, at 10:29 AM, Sebastian Sastre <
> sebastian at flowingconcept.com> wrote:
> >>
> >>> On Apr 17, 2014, at 10:08 AM, Yuriy Tymchuk <yuriy.tymchuk at me.com>
> wrote:
> >>>
> >>>> I would rather rename is to Block, as everyone is calling it a
> “block”.
> >>>
> >>> That might be actually a good idea
> >>>
> >>> sebastian
> >>>
> >>> o/
> >>>
> >>> PS: thinking in that line there is also ‘Context’ as, conceptually,
> what these blocks of code want to do is to keep the evaluation in a
> specific context. But to ease know-how transference and type less I’d
> rather go with the most popular name, as you suggested: ‘Block'
> >>>
> >>>
> >>
> >>
> >
> >
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140417/7e0b1ff0/attachment-0002.html>


More information about the Pharo-dev mailing list