Scripting languages and IDEs (was: If python goes EToys...)

Oscar Nierstrasz oscar at iam.unibe.ch
Thu Aug 24 12:13:50 UTC 2006


In a script we would expect everything to be executable (rather than  
simply declared), but what is a nice way to define new methods?  A  
declarative syntax would just state that methods are defined, rather  
than sending a message to a class asking it to add or redefine a method.

MyClass compile: 'mymethod ^ self'

just does not cut it.

But the declarative syntax:

MyClass mymethod [ ^ self ]

is not right either, since this can be interpreted as sending  
mymethod to MyClass and then sending a block to the result (which  
makes no sense).

Something like this would work, but is ugly to read:

MyClass defineMethod: #mymethod withBody: [ ^ self ]

MyClass defineMethod: #+ withBody: [ :other | ^ self add: other ]

MyClass defineMethod: #a:b: withBody: [ :anA : aB | ^ ... ]

It seems like some new syntax would be needed if you want readable  
and editable scripts.

Maybe some kind of bang-notation to separate method declarations from  
executable code is not so bad!

!MyClass>>mymethod
	^ self !

Oscar

On Aug 24, 2006, at 13:19, stéphane ducasse wrote:

> by the way I'm trying to understand why we cannot have a  
> declarative syntax for Smalltalk that still can be interpreted  
> dynamically or not. May be I'm not clear enough about what is the  
> declarative syntax: for me it means that I can read it and can  
> analyze it and get a model of the program (this does not exclude  
> executing it on the fly when I load the program).




More information about the Squeak-dev mailing list