[squeak-dev] Re: talk on Newspeak online

Igor Stasenko siguctua at gmail.com
Thu May 8 07:49:37 UTC 2008


2008/5/8 Klaus D. Witzel <klaus.witzel at cobss.com>:
> On Thu, 08 May 2008 04:56:11 +0200, Igor Stasenko wrote:
>
>
>
> > 2008/5/8 Vassili Bykov wrote:
> >
> > > I have considerable experience programming in both Smalltalk and
> > >  Newspeak, and (despite my email address) I'll say that Newspeak is an
> > >  improvement in a number of aspects. That includes constructors.
> > >
> >
>
>  [...big snip...]
>
>
>
> > About constructors.
> >
> > It is really easy to maintain same discipline in smalltalk.
> > Maybe its hackish, but its possible to implement w/o changing syntax:
> >
>
>  Heh! you seem to have the inlining compiler in mind when you give examples
> like the one below ;)
>
>  Anyways, hands up please: who's willing to be conformant, in her/his
> projects, to lengthy instance creation cobb salad (californian) like this?
>

The one, who want it to be strict. :)

Btw, no one disallow you from doing following:

MyStrictClass>>new
   self isInDevelopmentMode ifTrue: [self checkConstructor].
    ^ super new

so, it will cost you 1 extra send in deployed mode :)

>
>
>
> > MyStrictClass>>new
> >   self checkConstructor.
> >    ^ super new
> >
> > MyStrictClass>>checkConstructor
> >   | sender |
> >   [ sender := thisContext sender. sender sender receiver == self ]
> whileTrue.
> >    self assert: (self validConstructors includes: sender method selector )
> >
> > MyStrictClass>>validConstructors
> >   ^ ( #new )
> >
> > MyStrictSubClass>>x: aX y:aY
> >   ^ super new x: aY; y: aY; yourself.
> >
> > MyStrictSubClass>>validConstructors
> >   ^ ( #x:y: )
> >
> > MyStrictSubClass2>>validConstructors
> >   ^ ( #x:y: #new )  "allow constructors from superclass and from
> > superclass superclass"
> >
> >
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list