Hi all,
back to Coral after a (much too long) teaching hiatus, I'm pondering what the best solution is for the class declaration syntax. The usual message will always work, of course: SomeClass subclass: #NameOfNewClass instanceVariableNames: 'a b c' classVariableNames: 'D E F' poolDictionaries: '' category: 'Foo' But one idea of the prototype was to make that a bit more flexible and terse, by using a cascade: SomeClass < #NameOfNewClass iv: 'a b c'; shared: 'D E F'; package: 'Foo' Now the first problem is that #package is used by RPackage so redefining it on Class breaks the system. #package: might be less problematic but… for now I will switch back to #category: I was thinking SomeClass < #NameOfNewClass should return a builder object, but in that case there is no way for the builder to know when the cascade is finished; it can of course do things on the fly, but that implies recompiling the class for each message… not really beautiful. Suggestions? -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
#Luc 2011/12/15 Damien Pollet <[hidden email]> Hi all, we can also fix that the package message should be always sent as the latest one by convention. but that is not really good too. Luc
_______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
In reply to this post by Damien Pollet
> SomeClass < #NameOfNewClass
> iv: 'a b c'; > shared: 'D E F'; > package: 'Foo' Why not: SomeClass subclass: #NameOfNewClass vars: 'a b c D E F' package: 'APackage' Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
In reply to this post by Damien Pollet
On Dec 15, 2011, at 3:36 PM, Damien Pollet wrote: > > > I was thinking SomeClass < #NameOfNewClass should return a builder > object, but in that case there is no way for the builder to know when > the cascade is finished; it can of course do things on the fly, but > that implies recompiling the class for each message… not really > beautiful. > > Suggestions? I think Alex has a point: just don't use cascades. Add all the needed methods. (this forces people to keep the order, too). -- Marcus Denker -- http://marcusdenker.de _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
On 15 December 2011 17:27, Marcus Denker <[hidden email]> wrote:
> I think Alex has a point: just don't use cascades. Add all the needed methods. > (this forces people to keep the order, too). Fair enough. -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
Administrator
|
In reply to this post by Damien Pollet
SomeClass < #NameOfNewClass vars: 'a b c D E F' package: 'APackage'. where "SomeClass < #NameOfNewClass" returns your builder. Now you can define the combinations on the builder, effectively making arguments optional without bloating Class: package: vars:package: vars:classVars:package: vars:pools:package: pools:package: classVars:package: classVars:pools:package:
Cheers,
Sean |
In reply to this post by Damien Pollet
why do you want to have a builder?
Stef On Dec 15, 2011, at 3:36 PM, Damien Pollet wrote: > Hi all, > > back to Coral after a (much too long) teaching hiatus, I'm pondering > what the best solution is for the class declaration syntax. > > The usual message will always work, of course: > > SomeClass subclass: #NameOfNewClass > instanceVariableNames: 'a b c' > classVariableNames: 'D E F' > poolDictionaries: '' > category: 'Foo' > > But one idea of the prototype was to make that a bit more flexible and > terse, by using a cascade: > > SomeClass < #NameOfNewClass > iv: 'a b c'; > shared: 'D E F'; > package: 'Foo' > > Now the first problem is that #package is used by RPackage so > redefining it on Class breaks the system. #package: might be less > problematic but… for now I will switch back to #category: > > I was thinking SomeClass < #NameOfNewClass should return a builder > object, but in that case there is no way for the builder to know when > the cascade is finished; it can of course do things on the fly, but > that implies recompiling the class for each message… not really > beautiful. > > Suggestions? > > -- > Damien Pollet > type less, do more [ | ] http://people.untyped.org/damien.pollet > > _______________________________________________ > Pharo-coral mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
In reply to this post by abergel
you should have also
shared so you should get all the combination . but damien just use the simplest one and we will see. We should have a working version and that people use it + a documentation. On Dec 15, 2011, at 5:25 PM, Alexandre Bergel wrote: >> SomeClass < #NameOfNewClass >> iv: 'a b c'; >> shared: 'D E F'; >> package: 'Foo' > > Why not: > > SomeClass subclass: #NameOfNewClass > vars: 'a b c D E F' > package: 'APackage' > > Alexandre > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > _______________________________________________ > Pharo-coral mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral _______________________________________________ Pharo-coral mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-coral |
Free forum by Nabble | Edit this page |