[squeak-dev] Re: Why a package management system (Was: Re: Help
system now for Squeak and Pharo)
Göran Krampe
goran at krampe.se
Tue Feb 23 10:18:18 UTC 2010
Hi folks!
Andreas Raab wrote:
[SNIP]
> Compare this with a simple alternative (I'm not using XML because of the
> knee-jerk reaction to XML in this community):
>
> [Disclaimer: Please folks, don't come back and give this "oh but it
> doesn't do x,y,z" response that I can see coming at me. This is NOT an
> actual package spec, this is an example for what a simple package spec
> *might look like*]
>
> Package: HelpSystem-Core
> Version: 1.0
> Repository: http://www.squeaksource.com/HelpSystem
> Installs: HelpSystem-Core-tbn.1.mcz
> Installs: HelpSystem-Tests-tbn.1.mcz
>
> Package: HelpSystem
> Version: 1.0
> IntendedPlatform: Squeak
> IntendedVersion: 3.10
> Requires: HelpSystem-Core
> Repository: http://www.squeaksource.com/HelpSystem
> Installs: Squeak-Project-Help.1.mcz
>
> Package: HelpSystem
> Version: 1.0
> IntendedPlatform: Pharo
> IntendedVersion: 1.0
> Requires: HelpSystem-Core
> Repository: http://www.squeaksource.com/HelpSystem
> Installs: Pharo-Project-Help.1.mcz
>
> Package: HelpSystem
> Version: 1.1
> IntendedPlatform: Squeak
> IntendedVersion: 4.0
> Requires: HelpSystem-Core
> Repository: http://www.squeaksource.com/HelpSystem
> Installs: Squeak-Project-Help-tbn.4.mcz
>
> You can *read this and understand what it means*. You can fully document
> it in about fifteen minutes. You can write a parser that reads such
> definitions in five minutes (two if you'd be using XML because you'd
> have the parser already).
Ah! A challenge. Ok, so I tweaked your DSL a bit by:
- Surrounding all arguments with $' turning them into valid Squeak strings.
- Ending all lines with $. turning each line into a "keyword message".
...and then it is actually fully valid Tirade (see URLs at end of post)!
Let me demonstrate:
| input |
input := 'Package: ''HelpSystem-Core''.
Version: ''1.0''.
Repository: ''http://www.squeaksource.com/HelpSystem''.
Installs: ''HelpSystem-Core-tbn.1.mcz''.
Installs: ''HelpSystem-Tests-tbn.1.mcz''.
Package: ''HelpSystem''.
Version: ''1.0''.
IntendedPlatform: ''Squeak''.
IntendedVersion: ''3.10''.
Requires: ''HelpSystem-Core''.
Repository: ''http://www.squeaksource.com/HelpSystem''.
Installs: ''Squeak-Project-Help.1.mcz''.
Package: ''HelpSystem''.
Version: ''1.0''.
IntendedPlatform: ''Pharo''.
IntendedVersion: ''1.0''.
Requires: ''HelpSystem-Core''.
Repository: ''http://www.squeaksource.com/HelpSystem''.
Installs: ''Pharo-Project-Help.1.mcz''.
Package: ''HelpSystem''.
Version: ''1.1''.
IntendedPlatform: ''Squeak''.
IntendedVersion: ''4.0''.
Requires: ''HelpSystem-Core''.
Repository: ''http://www.squeaksource.com/HelpSystem''.
Installs: ''Squeak-Project-Help-tbn.4.mcz''.'.
(TiradeRecordingReader parse: input) asArray
----------------
Doing "alt-p" on the above gives:
#(#Package: #('HelpSystem-Core') #Version: #('1.0') #Repository:
#('http://www.squeaksource.com/HelpSystem') #Installs:
#('HelpSystem-Core-tbn.1.mcz') #Installs:
#('HelpSystem-Tests-tbn.1.mcz') #Package: #('HelpSystem') #Version:
#('1.0') #IntendedPlatform: #('Squeak') #IntendedVersion: #('3.10')
#Requires: #('HelpSystem-Core') #Repository:
#('http://www.squeaksource.com/HelpSystem') #Installs:
#('Squeak-Project-Help.1.mcz') #Package: #('HelpSystem') #Version:
#('1.0') #IntendedPlatform: #('Pharo') #IntendedVersion: #('1.0')
#Requires: #('HelpSystem-Core') #Repository:
#('http://www.squeaksource.com/HelpSystem') #Installs:
#('Pharo-Project-Help.1.mcz') #Package: #('HelpSystem') #Version:
#('1.1') #IntendedPlatform: #('Squeak') #IntendedVersion: #('4.0')
#Requires: #('HelpSystem-Core') #Repository:
#('http://www.squeaksource.com/HelpSystem') #Installs:
#('Squeak-Project-Help-tbn.4.mcz'))
Which is simply an Array representation of a series of Tirade messages.
Of course, TiradeRecordningReader just does that and nothing smarter :)
Improvements:
- We don't need to only use strings as arguments. Symbols are fine as is
numbers etc.
- We don't need to use one message per line (by ending each line with a
$.) but in this case it might actually be the easiest way.
And yeah, it only took me ... 2 min. But not writing a parser... but
stuffing in all the $' and $. :)
Ok, so you wonder what the HELL is Tirade? See my blog posts:
http://goran.krampe.se/blog/Squeak/Tirade.rdoc
http://goran.krampe.se/blog/Squeak/Tirade2.rdoc
http://goran.krampe.se/blog/Squeak/Tirade3.rdoc
regards, Göran
More information about the Squeak-dev
mailing list
|