help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] Community sprint


From: Mike Anderson
Subject: Re: [Help-smalltalk] Community sprint
Date: Fri, 29 Sep 2006 13:00:36 +0000
User-agent: Mozilla Thunderbird 1.0.5 (X11/20050711)

Luca Bruno wrote:
> In data 29 settembre 2006 alle ore 11:52:55, Paolo Bonzini
> <address@hidden> ha scritto:
> 
>>
>>>>> What are my dreams:
>>>>> 1) Have a good set of libraries
>>>>> 2) Create scalable and portable applications in smalltalk (GST is
>>>>> the  unique choice at the moment)
>>>>
>>>> 3) Have a decent and appealing scripting syntax -- no file-outs.
>>>>
>>> In what sense? You mean all that code for creating classes and
>>> methods  should be reinvented for scripting?
>>> Aren't file outs important for bringing out packages?
>>
>> Class name: #Number extend: #Object [
>>     Method [
>>         isNumber
>>             ^true
>>     ]
>> ]
>>
>> or something like that.  No "exclamation-mark separated" file-outs.
>>
>> Paolo

There's a horrible java-smell coming off that :-b

> That would change the syntax

Bear in mind that the syntax is already 'changed' by #methodsFor:, which
switches from 'interpreter' mode to 'method compilation' mode.

>... maybe something like this would be
> reproducible in a smalltalk-like way:
> 
> Object subclass: #Foo
>     instanceVariableNames: 'a'
>     instanceMethods: {
> #'initialize-release' -> {
>     'initialize
>         a := ''foo'''
> }.
> #'accessing' -> {
>     'a
>         ^a'
> }}
>     ...
> !
> 
> Logically, using a string is not the best way to define a method (using
> #compile:category: in this case) but can be a useful thing at the
> beginning.

Doubling-up of the quotes around strings gets annoying very quickly.

Also, that syntax suggests that the methods of a class have to be
declared when the class itself is declared, but one of the ways in which
Smalltalk wins big is that you can add/change methods in
already-declared classes (and change their declaration, but I don't find
the need to do that so often).

I actually quite like the file-out format (maybe it's just that I've
done a lot of coding in it), although it is a shame that it makes the
exclamation mark unavailable for selectors. My suggestions for
improvements are simply to add the following convenience methods which
simply save some typing:

Class >> #subclass:
Class >> #subclass:instVarNames:
Class >> #subclass:instVarNames:classVarNames:

and remove the "don't use this" comment in Behavior >> #methods.

Writing this, I did wonder if it would be nice for #>> itself to switch
to method compilation mode for one method only if the method is not
already present:

String >> #asThingumy !
        ^self shouldNotImplement.
!

String >> #asBob !
        ^self subclassResponsibility.
!

> Also, i see in Squeak that #new calls #initialize, i don't see this
> behavior here, what about?

I thought that got added a while back. Did it not make it to the stable
series?

Regards,

Mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]