Squeak SSP-- huh?

Stephen Pair spair at advantive.com
Wed Apr 3 19:19:56 UTC 2002


Hi Nevin...there is definitely something wrong...it should not be
converting your text back to regular Smalltalk (it's probably the pretty
printing as Bijan said).  As he also points out, it's just a handy way
to stream text (any text) with embedded smalltalk expressions.  I prefer
this method to file based schemes for the same reason that Bijan does.
I used them extensively to render the Swiki.net pages (there real
benefit starts to show when you start rendering pages in a much more
object oriented and modular way).

Now...there is certainly room for improvement...such as making it work
with pretty printing.

One example of leveraging the OO capabilities is to add a method like
#printOn: to Object, but call it #htmlOn: (and do it with ssp).  This
method could render a small inspector like table by default, and be
overridden by any object that wants a more specialized look.  Then you
could embed any object in a larger HTML page and get the full benefit of
polymorphism when rendering the page.  Of course, you can accomplish the
same thing without SSP (as SSP is really just an alternate syntax), but
it makes life simpler by not having to put double ticks where single
ticks are needed, or trying to weave a little bit of smalltalk into a
large chunk of text.

- Stephen

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Nevin Pratt
> Sent: Wednesday, April 03, 2002 1:25 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Squeak SSP-- huh?
> 
> 
> I've been playing around with the SSP stuff at 
> http://ssp-squeak.swiki.net, and quite frankly, I'm at a loss at 
> understanding what good it is.
> 
> Well, it's a totally different animal than the SSP work that 
> Alan Knight 
> did for VW.  For one thing, you write your "Active Smalltalk 
> Pages" in 
> the Class Browser instead of using external files.  Hmmm, that might 
> even be useful, except for the way it works.
> 
> OK, I type the example from the swiki into the browser (any class):
> 
> **************
>      serveletExampleOn: strm
>         <ssp on: strm>
> 
>         This is an example servelet method.  I can embed code in this
>         string as follows:  <%= (1 + 1) printString %>.
> **************
> 
> 
> I then "accept" the method, and... voila!  The method 
> magically changes 
>   to normal Smalltalk code of (I am using Squeak 3.2gamma):
> 
> 
> **************
>      servletExampleOn: strm
>         strm nextPutAll: 'This is an example servelet method. 
>  I can embed code in the string as follows: ',
>         (1 + 1) printString sspStreamOn: strm.
>         strm nextPutAll: '.
> '
> **************
> 
> 
> (in case anyone is curious, the implementation of 
> #sspStreamOn: is just: 
>   strm nextPutAll: self)
> 
> Now, the problem with the above is that if I had wanted it to 
> convert my 
> original HTML/SSP source string to pure Smalltalk code, I would have 
> written it in pure Smalltalk in the first place.  It doesn't 
> preserve my 
> original code *at all*.  Nor is there apparantly any easy way 
> to feed it 
> an arbitrary string read in from an external file.
> 
> Now, if you compare this to the work that Alan did with VW...
> 
> ...with Alan's work, I can have my 12 year old son do HTML pages with 
> Dreamweaver (my son's tool of choice), and then gradually 
> introduce him 
> to embedded Smalltalk code within his HTML pages, thus giving him a 
> gradual introduction to Smalltalk.
> 
> I don't see any way of doing anything like that with the Squeak SSP 
> stuff.  For that matter, I have a hard time seeing any use for the 
> Squeak approach *at all*.  I would just write Smalltalk code 
> rather than 
> let the SSP parser convert my HTML/SSP code to Smalltalk for me.
> 
> Anybody have contrasting points of view?  I'd love to hear from you.
> 
> Nevin
> 
> 
> 
> 




More information about the Squeak-dev mailing list