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

RE: What is a lightweight language



This discussion on continuations is reminiscent of discussions over the
years on Smalltalk blocks. 

---
Is anyone here familiar with blocks in Smalltalk?
---

With regard to Smalltalk blocks, most people who use Smalltalk see them
as lexical scopes. Where they use them as continuations and closures
they typically do so with transparent ease and comfort even though most
Smalltalkers do not (or didn't until more recent times) really know what
they are [including, unfortunately, a number of the early/original
implementers of Smalltalk].

I comment on this because I've been aggressive in designing blocks as
optimized closures and continuations within Smalltalk starting with the
first QKS implementations I did in 1991-92. This work went hand-in-hand
with that MacOS implementation's pre-emptive green [persistable]
threads. 

-- example of intrinsic continuation/closure usage --
In SmallScript the zero cost exception mechanism is based on lazy
downward-continuations (carried over from QKS Smalltalk which I also
designed). Calling them "downward-continuations" is new to me; I just
learned that terminology for them in reading this group. In the
Smalltalk context, they have been discussed at some length in
c.l.smalltalk over the last couple of years because I was looking for
community feedback on syntax for a general declaration form for
explicitly annotating/declaring blocks [we were calling them
non-capturable blocks].
-- end example --
 
At that time (1987-1992), documentation/papers on GC, dynamic languages,
and Smalltalk were virtually non-existant (at least I couldn't obtain
any). Thus, since I did not actually have a Smalltalk to work on and
thus I "read significantly more into the Smalltalk-80 language book"
than it really encompassed. 

The QKS SmalltalkAgents Macintosh implementation provided the first
proper "block" closures and continuations for Smalltalk. Subsequently it
put pressure on other Smalltalk implementations as peer pressure in the
community recognized it was important to get them right and that they
were genuinely valuable for a variety of programming problems [depending
on your programming style]. 

In my time on the ANSI Smalltalk standards committee, proper block
closures and continuations were one of my focal points. I only partially
won that effort in that the standard specified full closures but not
proper continuations.

However, even today, squeak does not have proper closures and only a few
of the smalltalks have optimized blocks/contexts very significantly.
Only the smalltalk implementations I've developed support facilities for
continuation style usage including variable arity to enable &rest style
(var arg and named arg) argument facilities.

While the frameworks I have built have made use of the extended
capabilities to good effect, the lack of proper continuations and
closures in Smalltalk has not, in general, been a critical issue. It has
had detrimental impact on various parties trying to implement AOP
facilities; and has also resulted in much goofiness in squeak
frameworks. 

The point being that partial closures and continuations were crucial to
making the Smalltalk language design work [i.e., some object was needed
to represent lexical contexts in a language where everything is an
object]. They are an intrinsic part of the language that almost every
Smalltalker intuitively grasps without being consciously aware of it. 

However, based on many (Smalltalk related) discussions regarding blocks,
both first-hand and on c.l.smalltalk, and descriptions in various
Smalltalk books, I would say that most Smalltalkers do not really
understand the ideas fully and thus do not think about problems in ways
that would require full closures and continuations. 

In part, I think this is because Smalltalkers do not program in a
functional style.

What do some of you think about this?

-- Dave S. [SmallScript LLC]

SmallScript for the AOS & .NET Platforms
David.Simmons@SmallScript.com | http://www.smallscript.org


> -----Original Message-----
> From: owner-ll1-discuss@ai.mit.edu
[mailto:owner-ll1-discuss@ai.mit.edu]
> On Behalf Of Shriram Krishnamurthi
> Sent: Tuesday, December 11, 2001 8:12 PM
> To: Paul Graham
> Cc: ll1-discuss@ai.mit.edu
> Subject: Re: What is a lightweight language
> 
> Paul, I'm not in the least trying to argue that *continuations* aren't
> mind-bending.  They are; they sure messed with my noggin.
> 
> All I'm trying to refute is the claim that one can't approach Scheme
> without understanding continuations, or that the presence of
> continuations makes Scheme itself difficult to learn.  As with most
> languages, there are parts that are easy and others that are hard.
> You can write incredibly productive programs in Scheme without
> continuations.  And lots and lots of people do!
> 
> Shriram