genuine squeak newbie

Randal L. Schwartz merlyn at stonehenge.com
Mon Jun 21 14:55:29 UTC 1999


>>>>> "Peter" == Suk, Peter K <psuk at cincom.com> writes:

Peter> There are some interesting parallels between Perl and
Peter> Smalltalk.  In both communities, there is something like a
Peter> class library which can be leveraged.  Development in both
Peter> languages is iterative.  The Perl community does a better job
Peter> of sharing and reusing code, IMO.  Perl also benefitted from
Peter> the explosion of the Web in the same way Java did.  (Smalltalk
Peter> missed the boat there, unfortunately.)

Peter> What about running Perl on top of the Squeak VM, and providing
Peter> some things that are missing in Perl?  (Like Regular
Peter> Expressions as first class objects)

I've been pondering various combinations of Perl and Smalltalk
ever since Perl5 was introduced.

One of my "far back burner pet projects" would be to alter the C-code
generator of Squeak so that it produced native Perl code rather than C
code.  Done correctly, method lookup could be handled as native Perl
methods, since the Perl model is richer than the Smalltalk model, so
byte-coded methods would handled as Perl native subroutines.

Imagine the entire Squeak image recompiled to run under Perl/Tk. :)

Or at least all the non-GUI classes running as command-line
Small-Perl.

But another (more doable) project would be to embed Perl as a
Smalltalk primitive:

    anInterpeter _ Perl new.
    result _ anInterpreter scalarEval: '2 + 3'.

Stuff like that.  We could even map anon-subs:

    arrayResult _ anInterpreter arrayEval: 'map $_ + 5, @_' with: someArray

with the input coming into @_.  Then you can get your regex as:

    Perl>>match: string withRegex: regex
        self: scalarEval: '$_[0] =~ $_[1]' with: {string. regex}

This would be cool.  The mapping between Perl type (primitive or
object) and Smalltalk classes would be an interesting exercise, but
I've thought about it quite a bit.  We could even return opaque
objects (like coderefs) that could be handed to further invocations.

One of the hard parts would be calling back into smalltalk.. we may
have to let Perl be completely driven with Smalltalk doing the driving
only, simply because primitives aren't really supposed to be executing
smalltalk code. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn at stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn at teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me





More information about the Squeak-dev mailing list