Tuesday, December 21, 2010

Metacello ConfigurationOfAida

  Gofer new
    squeaksource: 'MetacelloRepository';
    package: 'ConfigurationOfAida';
    load.

  ((Smalltalk at: #ConfigurationOfAida) project version: '6.0') load.

"the above is the code for a DoIt in a Pharo or Squeak Smalltalk workspace so as to load AIDA/Web by Janko Mivšek."

"This and the above are in quotes because Smalltalk comments in code are in dbl-quotes."

"The two semi-colons above permit three messages to be sent in series to the instance of the Gofer service. A period (full-stop) ends those two keyword messages and the final unary message."

"What is argably not clear is that the first two messages set values in slots but the last directs an action. I say this because 'load' is not unambiguously a verb in English.  It would have been lovely if set and do had been available as no op sugar useful to an Slint."

  Gofer new
    set squeaksource: 'MetacelloRepository';
    set package: 'ConfigurationOfAida';
    do load.

"An easy mod to most Smalltalk implementations would be "
  Gofer new
    set_squeaksource: 'MetacelloRepository';
    set_package: 'ConfigurationOfAida';
    do_load.

"One up-side might be reminding developers to not hide actions in methods which consume value arguments. But that ship sailed in 1980 or earlier.

Here is the added quibble: the first two values are names (the second is certainly not a package qua object) and so this code might better have been more revealing as: "

  Gofer new
    set_squeaksource_id: 'MetacelloRepository';
    set_package_name: 'ConfigurationOfAida';
    do_load_package.
   Transcript nextPutAll: 'I blasphemed against ST.'

"What cannot yet be done is to send a message to a class
  >>requestFreshObject
and have the class request the needed parameters of YOU either then or at the time of the proposed action.

I say this because >>new is not the sole means of acquiring a reference to an instance. "

  >>new
    ^self shouldNotImplement 
" a possible class method in Gofer "
 
   Gofer default   "would be no surprise"

   SmalltalkComms currentGofer   " may lie in the offing.

So "

   Smalltalk user: me requires: (package named: 'Aida') from: (Metacello squeakSource).

"Unlike Curl, in Smalltalk the order of those keywords matters because no semi-colon means that the last message send used only one selector named
    user:requires:from:
and only by looking at the actual code would you maybe know which objects to supply.

And yet "
  Gofer new
    squeaksource: 'MetacelloRepository';
    package: 'ConfigurationOfAida';
    load.
" is so easy - provided that you already know to use Gofer and also know to provide a version as in "

   (Smalltalk at: #ConfigurationOfAida) project version: '6.0') load


" That last direct call into the global Smalltalk dictionary is a sure sign that even this great improvement in loading packages into Smalltalk is an improvement itself awaiting another iteration.

For generations, introductions to Smalltalk have glossed over the pragmatics of Smalltalk - the actual use of Smalltalk in context for some end.  It may even be that calling Smalltalk a 'language' is itself misleading and so I should not use the 'pragmatics' metaphor.  Back to guilds and artisans?
"

No comments: