From: atl
Subject: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <928040402.6626@www.remarq.com>
I'm fairly new to LISP.  Blocks in Smalltalk(statement
sequences enclosed in square brackets) are very flexible.
YOu must explicitly execute a statement by sending the value
message to the block.  You can also assign blocks to
variables and pass them around.  What LISP feature most
closely resembles Smalltalk blocks?




**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****

From: Erik Naggum
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <3137032296419883@naggum.no>
* atl <·········@web.remarq.com>
| I'm fairly new to LISP.  Blocks in Smalltalk(statement sequences enclosed
| in square brackets) are very flexible.  YOu must explicitly execute a
| statement by sending the value message to the block.  You can also assign
| blocks to variables and pass them around.  What LISP feature most closely
| resembles Smalltalk blocks?

  lambda expressions, which are more powerful than blocks, of course, but
  also slightly more verbose unless you invent your own syntax, which is
  also trivial to do.

#:Erik
-- 
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century
From: Tim Olson
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <tim-3005990814490001@jump-tnt-0006.customer.jump.net>
In article <················@naggum.no>, Erik Naggum <····@naggum.no> wrote:

|   lambda expressions, which are more powerful than blocks, of course, but
|   also slightly more verbose unless you invent your own syntax, which is
|   also trivial to do.

How are lambda expressions more powerful than Smalltalk blocks?  I'm much
more familiar with Scheme, but lambdas in Scheme appear to be equivalent
to blocks in Smalltalks that implement full closure semantics.

-- 

     -- Tim Olson
From: Frank A. Adrian
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <9Xh43.4197$Np1.222705@news.uswest.net>
Except that the Smalltalk standard (IIRC) does not require that variables in
methods and blocks be lexically closed.  Most commercial implementations
have this feature, but Squeak doesn't and Digitalk's Smalltalk V didn't have
it until 1994 or so (right before the merger w/ParcPlace).  As we all know,
a feature that you can't depend on being there is not a feature of a
language.  So for now, Smalltalk blocks ARE less powerful (in general) than
LISP blocks.

faa

Tim Olson <···@jumpnet.com> wrote in message
·························@jump-tnt-0006.customer.jump.net...
> In article <················@naggum.no>, Erik Naggum <····@naggum.no>
wrote:
>
> |   lambda expressions, which are more powerful than blocks, of course,
but
> |   also slightly more verbose unless you invent your own syntax, which is
> |   also trivial to do.
>
> How are lambda expressions more powerful than Smalltalk blocks?  I'm much
> more familiar with Scheme, but lambdas in Scheme appear to be equivalent
> to blocks in Smalltalks that implement full closure semantics.
>
> --
>
>      -- Tim Olson
From: Tim Olson
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <tim-3005991909180001@jump-tnt-0130.customer.jump.net>
In article <·····················@news.uswest.net>, "Frank A. Adrian"
<·······@uswest.net> wrote:

| Except that the Smalltalk standard (IIRC) does not require that variables in
| methods and blocks be lexically closed.

The draft version I have (1.9) does seem to require that blocks be
implemented as closures:

-----
Section 3.4.4 Blocks

Expressions within a block may reference temporary variables and arguments
of the functions that enclose the block. Each block object is an
independent closure that captures the current bindings for any enclosing
functions' arguments or temporaries that are referenced from within the
block's <block constructor>. Any such captured bindings and their
associated discrete variables or objects must be preserved as long as the
block object continues to exist and is available for evaluation. Note that
the values of any such captured discrete variables and the state of any
object captured by an argument binding remain subject to possible
modification.
-----

You are correct that Squeak does not currently implement blocks like this,
but as far as I know all other Smalltalks do (and most folks are pushing
to have Squeak do so, as well).

-- 

     -- Tim Olson
From: Frank A. Adrian
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <fBk43.4683$Np1.239670@news.uswest.net>
Thanks for your adjustment of my memory.  I don't want to denigrate
Smalltalk (it being my second favorite language and all).  I was fairly
certain that all of the currently available commercial products were
lexically closed and I knew Squeak wasn't.  I also remembered that the
Smalltalk standard was pretty weaselly and wimpy when it actually came to
nailing a lot of things down (e.g., exception processing, UI, MOP issues)
and the last time I checked (a long time ago), there was still a lot of
debate over how strict to make certain issues (lexical scoping being one of
them).  Most of the cases had been resolved in terms of "let a thousand
flowers bloom", and I assumed that this one had, too.  Mea culpa, and my
apologies to the Smalltalkers who check in here.  At least they got this one
right :-)...

faa

Tim Olson <···@jumpnet.com> wrote in message
·························@jump-tnt-0130.customer.jump.net...
> In article <·····················@news.uswest.net>, "Frank A. Adrian"
> <·······@uswest.net> wrote:
>
> | Except that the Smalltalk standard (IIRC) does not require that
variables in
> | methods and blocks be lexically closed.
>
> The draft version I have (1.9) does seem to require that blocks be
> implemented as closures:
>
> -----
> Section 3.4.4 Blocks
>
> Expressions within a block may reference temporary variables and arguments
> of the functions that enclose the block. Each block object is an
> independent closure that captures the current bindings for any enclosing
> functions' arguments or temporaries that are referenced from within the
> block's <block constructor>. Any such captured bindings and their
> associated discrete variables or objects must be preserved as long as the
> block object continues to exist and is available for evaluation. Note that
> the values of any such captured discrete variables and the state of any
> object captured by an argument binding remain subject to possible
> modification.
> -----
>
> You are correct that Squeak does not currently implement blocks like this,
> but as far as I know all other Smalltalks do (and most folks are pushing
> to have Squeak do so, as well).
>
> --
>
>      -- Tim Olson
From: atl
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <928115696.10939@www.remarq.com>
so let me get this straight, the answer to my original
question is that lamba expressions are the LISP feature that
most closely resemble smalltalk blocks?



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
From: Ian Wild
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <3752427F.F3FEC877@cfmu.eurocontrol.be>
atl wrote:
> 
> so let me get this straight, the answer to my original
> question is that lamba expressions are the LISP feature that
> most closely resemble smalltalk blocks?


Lambda expressions certainly resemble blocks *quite*
closely.  Why do you insist on the feature that
"most closely" resembles blocks.  Homework?
From: Erik Naggum
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <3137133347086637@naggum.no>
* atl <·········@web.remarq.com>
| so let me get this straight, the answer to my original question is that
| lamba expressions are the LISP feature that most closely resemble
| smalltalk blocks?

  among symbols, complex numbers, hash tables, closures, streams, classes,
  conditions, and a better syntax, just to take a few Lisp features, it
  _still_ looks like closures most closely resemble Smalltalk blocks.

  your question looks facetious.  why are you asking such a funny question
  and being so serious about it?  what are you _really_ wondering about?

#:Erik
-- 
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century
From: Tim Bradshaw
Subject: Re: LISP feature comparability to Smalltalk??
Date: 
Message-ID: <ey3btf251xo.fsf@lostwithiel.tfeb.org>
* atl  wrote:
> I'm fairly new to LISP.  Blocks in Smalltalk(statement
> sequences enclosed in square brackets) are very flexible.
> YOu must explicitly execute a statement by sending the value
> message to the block.  You can also assign blocks to
> variables and pass them around.  What LISP feature most
> closely resembles Smalltalk blocks?

A block is pretty much like a lambda expressions in Lisp, and FUNCALL
is the equivalent of sending the value message:

    (setf f #'(lambda ()
		(+ 1 2)))

    (funcall f) -> 3

But you can also do rather more than this:

    (setf f #'(lambda (y)
		(+ 2 y)))

    (funcall f 3) -> 5

    (setf f (let ((v 0))
	      #'(lambda (&optional (inc 1))
		  (setf v (+ v inc)))))

    (funcall f) -> 1
    (funcall f) -> 2
    (funcall f 11) -> 13

--tim