Dear Squeakers,
When writing papers with Smalltalk code, or even sometimes when programming, I noticed that we need some way to express method definitions in a simple text file while still showing the class where they are defined. The current (legacy) file in/out format proves inappropriate. I wanted to get ride of exclamation mark and ease linking methods to classes. So, I started thinking of something else, and started a new project on this topic on SqueakSource:
http://www.squeaksource.com/NewFileInOutFormat.html
My target is to have .st files as a squence of any valid Smalltalk expression and to provide a simple protocol for defining methods. For now, method definitions are possible using, two messages.
-The first one is short and allows adding a method to a class without taking care of the category (the method appears in the browser 'as yet unclassified'). Example : MyClass << #(myMethod "Body of myMethod" )
-The second message to add a method under some particular category. Example : MyClass inCategory: #someCategory addMethod: #(myMethod "Body of myMethod" )
For comparison, here is the same example in the file In/Out format currently used in Squeak !MyClass methodsFor: 'someCategory' stamp: 'nbo 5/23/2006 12:08'! myMethod "Body of myMethod"! !
Note that the current version is still uncomplete. It does lose comments, author info, timestamps, and formatting (though the installed code is formatted using the pretty printer).
Noury -------------------------------------------------------------- Dr. Noury Bouraqadi - Enseignant/Chercheur Ecole des Mines de Douai - Dept. G.I.P http://csl.ensm-douai.fr/noury
European Smalltalk Users Group Board http://www.esug.org
Squeak: an Open Source Smalltalk http://www.squeak.org --------------------------------------------------------------
I have throught that an XML form would be good so that search engines would turn the entire internet into a single searchable repository. VisualWorks uses XML for input/output but it isn't a good format. I recall that another version of Smalltalk has a better version, but I don't remember which one.
If you are primarily interested in publishing code in papers, you ought to produce rtf or LaTex or something similar, and not worry about filing it in.
One thing to worry about with treating an entire source file as a single Smalltalk expression is that the compiler has a limit on the number of literatls. I don't know what it is, but that will limit the number of methods you can have in a file.
-Ralph Johnson
Le 29 mai 06, à 12:33, Ralph Johnson a écrit :
I have throught that an XML form would be good so that search engines would turn the entire internet into a single searchable repository. VisualWorks uses XML for input/output but it isn't a good format. I recall that another version of Smalltalk has a better version, but I don't remember which one.
But, XML is hardly readable/editable by humans. I think we should have both XML and non-XML formats. The first for machines and the second for humans.
If you are primarily interested in publishing code in papers, you ought to produce rtf or LaTex or something similar, and not worry about filing it in.
No, this is not my primary goal. But, I wanted to have the equivalent of MyClass>>#myMethod for providing method definitions. So, I added :
MyClass<<#(myMethod "methodBody")
One thing to worry about with treating an entire source file as a single Smalltalk expression is that the compiler has a limit on the number of literatls. I don't know what it is, but that will limit the number of methods you can have in a file.
No, I don't want to have the entire file as a single expression, but a sequence of expressions that will be parsed and evaluated successively.
Noury -------------------------------------------------------------- Dr. Noury Bouraqadi - Enseignant/Chercheur Ecole des Mines de Douai - Dept. G.I.P http://csl.ensm-douai.fr/noury
European Smalltalk Users Group Board http://www.esug.org
Squeak: an Open Source Smalltalk http://www.squeak.org --------------------------------------------------------------
Hi Noury!
I also have been playing with a smalltalk syntax: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= package MyPackage
Bar < Foo (a b c).
Foo class foo: x { 5 + 6 } Foo bar { ^ self bar } -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
For instance...
Cheeres, Alexandre
Am May 29, 2006 um 12:58 PM schrieb Noury Bouraqadi:
Le 29 mai 06, à 12:33, Ralph Johnson a écrit :
I have throught that an XML form would be good so that search engines would turn the entire internet into a single searchable repository. VisualWorks uses XML for input/output but it isn't a good format. I recall that another version of Smalltalk has a better version, but I don't remember which one.
But, XML is hardly readable/editable by humans. I think we should have both XML and non-XML formats. The first for machines and the second for humans.
If you are primarily interested in publishing code in papers, you ought to produce rtf or LaTex or something similar, and not worry about filing it in.
No, this is not my primary goal. But, I wanted to have the equivalent of MyClass>>#myMethod for providing method definitions. So, I added :
MyClass<<#(myMethod "methodBody")
One thing to worry about with treating an entire source file as a single Smalltalk expression is that the compiler has a limit on the number of literatls. I don't know what it is, but that will limit the number of methods you can have in a file.
No, I don't want to have the entire file as a single expression, but a sequence of expressions that will be parsed and evaluated successively.
Noury
Dr. Noury Bouraqadi - Enseignant/Chercheur Ecole des Mines de Douai - Dept. G.I.P http://csl.ensm-douai.fr/noury
European Smalltalk Users Group Board http://www.esug.org
Squeak: an Open Source Smalltalk http://www.squeak.org
Hi!
You might want to take a look at the format that Ian uses in his new Idst compiler. I find it to be quite readable and I assume Ian has thought it through a bit:
http://piumarta.com/pepsi/idst5-1.tar.gz
Check the .st files under examples.
regards, Göran
Noury Bouraqadi bouraqadi@ensm-douai.fr wrote:
Dear Squeakers,
When writing papers with Smalltalk code, or even sometimes when programming, I noticed that we need some way to express method definitions in a simple text file while still showing the class where they are defined.
Hi noury
why not
KernelPackage import: Point. Package declare: 'ColoredPointPackage'.
Point < ColoredPpoint variables: 'x y' ; classvar: 'Foo'. ColoredPoint>>foo: zork <category: 'foobar'> <author: 'sd' date: '24/06/2006'> [ ljkljl ^klk;lk; ].
or what damien proposed
ColoredPoint >> [ foo:aFoo bar:aBar | self doStuff. ]
On 29 mai 06, at 12:11, Noury Bouraqadi wrote:
Dear Squeakers,
When writing papers with Smalltalk code, or even sometimes when programming, I noticed that we need some way to express method definitions in a simple text file while still showing the class where they are defined. The current (legacy) file in/out format proves inappropriate. I wanted to get ride of exclamation mark and ease linking methods to classes. So, I started thinking of something else, and started a new project on this topic on SqueakSource:
http://www.squeaksource.com/NewFileInOutFormat.html
My target is to have .st files as a squence of any valid Smalltalk expression and to provide a simple protocol for defining methods. For now, method definitions are possible using, two messages.
-The first one is short and allows adding a method to a class without taking care of the category (the method appears in the browser 'as yet unclassified'). Example : MyClass << #(myMethod "Body of myMethod" )
-The second message to add a method under some particular category. Example : MyClass inCategory: #someCategory addMethod: #(myMethod "Body of myMethod" )
For comparison, here is the same example in the file In/Out format currently used in Squeak !MyClass methodsFor: 'someCategory' stamp: 'nbo 5/23/2006 12:08'! myMethod "Body of myMethod"! !
Note that the current version is still uncomplete. It does lose comments, author info, timestamps, and formatting (though the installed code is formatted using the pretty printer).
Noury
Dr. Noury Bouraqadi - Enseignant/Chercheur Ecole des Mines de Douai - Dept. G.I.P http://csl.ensm-douai.fr/noury
European Smalltalk Users Group Board http://www.esug.org
Squeak: an Open Source Smalltalk http://www.squeak.org
squeak-dev@lists.squeakfoundation.org