[Cuis] [SOLVED] Re: Copy vs Clone

Ken.Dickey Ken.Dickey at whidbey.com
Fri May 15 18:14:46 CDT 2015


Hi Juan,

Thanks for your time and the example code.  

As a long time user of Scheme, Lisp, Dylan, and other languages we have some differences of opinion.

Personal reflections follow.


> Squeak existed without closures for over 10 years.

Yes. Squeak ignored the Smalltalk standard.

This is a polarizing issue for some people.  I refused to use Squeak until closures were supported.


> >> Sometimes I think it would be nicer if all closures were clean. I'm not
> >> really sure what would we lose with such restriction...

Looking out from the other side of the mirror, Schemers had the saying "Objects are a poor man's Closures".  I have implemented quite a number of object systems in Scheme in a variety of styles.

Closures and Objects are in a sense duals.  One can implement Scheme in Smalltalk or Smalltalk in Scheme. I did an implementation of R5RS Scheme in Squeak which passed the test suite.  So call me linguistically promiscuous.


> Well, I took a look at the image you sent me (btw, neat stuff!). My 
> point is that usually we don't really need closures:

Right.  I can flatten environments by hand instead of letting the compiler do it.  Call me lazy.

However, one can serialize closures and might be called lazy if that bit is left undone.  ;^)

Given the seemingly continuous changes in compilation strategies with Squeak/Pharo, I would not choose to do this in neglect of more fun things to do.

The problem in this case is not that copy serializes Morphs, but that in the absence of network export it should NOT be serializing closures.

That would be killing flies with a sledge hammer.


> The code you sent me uses b). It stores state in variables in the 
> context of the closure. But this is not really needed. I could convert 
> your code to c). See the attach. 

Again.  Thank you very much for taking the time and trouble to do this.  It was very thoughtful of you.

> What I did is to take that state and 
> store it in an instance variable. There was yet another variable that 
> could simply be a temporal inside the block. 

Again, I am lazy.  I am used to letting the compiler do the work of optimizing environments and using closures to prototype until I figure out the typical usage pattern(s).


> I think it would be good to have different syntax for "clean" or 
> "context free" blocks. And encourage their use above real closures, 
> whenever possible.

I am just not used to flattening and managing environments by hand, used real closures for too many years.  As you saw from 
	http://www.iro.umontreal.ca/~feeley/papers/FeeleyLapalmeCL92.pdf
I know how to play compiler, and I have done enough runtime work (wrote a GC in 88k assembler among other things) to know the basics.

I guess I may have to be less lazy. 

What a shame!   ;^)

Thanks again,
-KenD




More information about the Cuis mailing list