Am Donnerstag, 13. September 2007 22:00:55 schrieb Peter William Lount:
Hi,
Hi, first I want to say, that I'm thinking of the same ideas that you think of and I really like the [a. b. c.] values idea.
[ Object subclass: #Person.
Person addInstanceVariable: #firstName; addInstanceVariable: #middleName; addInstanceVariable: #lastName. "Block form." Person addInstanceMethod: [firstName: aString | firstName := aString ]. "Same method as the line above, in method form this time." Person addInstanceMethod: [ firstName: aString firstName := aString ].
However, you indeed change the syntax of blocks for merging block syntax with method syntax when you say
[firstName: aString | firstName := aString ].
aren't you? at least as far as I know ST80... ;) . I would prefer something like this:
Person addInstanceMethod: [ :aString | firstName := aString ] named: #firstName:
I personally like to see a Block as a simple collection of statements. That it is internally compiled to some bytecode sequence _not_ necessarily representing the different statement borders is just an optimization for the sake of speed. Howerver, instead of byte code I'm dreaming of some kind of AST... Be aware, that you can represent any tree data structure with a sequential array resulting in just another form of "byte code". ;)
All the best,
Peter
Regards, Martin