Getting NewCompiler/re-entrant blocks to work - Re: [Newbies] block in recursion, Any cure for that kind of situation?

Marcin Tustin mm3 at zepler.net
Wed Jan 23 16:30:47 UTC 2008


Thanks. The approach that worked best by far was to load just
NewCompilerLoader, then do:
NewCompilerLoader new loadPackages.
Then to correct syntax errors as they came up. The first error that wasn't a
simple extra full-stop halted the recompilation process (because I couldn't
fix it), but enabling the options mentioned meant that blocks are now fully
reentrant. Excellent!

On Jan 23, 2008 12:26 AM, Mathieu Suen <mathk.sue at gmail.com> wrote:

> On Jan 23, 2008, at 1:00 AM, Marcin Tustin wrote:
>
> > So am I right in thinking that if I get newCompiler, blocks will
> > work as I would expect them to (like lambdas)?
> >
> > If so, how do I get the most recent version? I remember there being
> > something that has superceded squeakmap, but I can't seem to find it.
>
> You can find it on squeaksource.
> http://www.squeaksource.com/NewCompiler.html
>
> You first need to load AST NewParser RefactoringEgine and SmaccRuntime.
> In other to load them all you could use the NewCompilerLoader
> availible one the NewCompiler squeaksource repository.
> Simply invoke:
> NewCompilerLoader new loadPackage.
>
> This will recompile the complete image using the NewCompiler.
>
> To avoid the recompilation you can look at the loadPackage method.
> You could also load the NewCompiler throw the Universe browser.
>
> After loading the compiler you have 2 way to compile code.
>
> 1. Use the NewCompiler but don't make full block closure. (Preference
> browser section compile #compileUseNewCompiler)
>
>        In this mode the block still remain the same and temp are share
>        among the home context. That the reason why you could not invoke
>        recursively a block.
>
> 2. Enable the block closure. (Preference browser section compile
> #compileBlocksAsClosures)
>
>        With this preference the block while be transform in full block
> closure. You could then recursively
>        invoke a block. Block while then create a environment  to store
> temps
> whenever is needed.
>
>
> HTH
> Cheers,
>
>
> >
> >
> > On Jan 22, 2008 11:42 PM, Ben Goetter <goetter at mazama.net> wrote:
> > >This is a maintenance nightmare waiting to happen.  Use a proper
> > method call,
> >
> > Squeak Smalltalk blocks are just similar enough to Scheme lambdas
> > that I still fall into this trap, too.
> >
> > (letrec ((carre (lambda (s1 s2 s3 s4 n)
> >                 (if (> n 0)
> >                  (carre (segment s1 s2)
> >                         (segment s2 s3)
> >                         (segment s3 s4)
> >                         (segment s1 s4)
> >                         (- n 1))))))
> >  'oops-must-remember-this-is-Squeak-not-Scheme)
> >
> > Ben
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>        Mth
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080123/04e30710/attachment.htm


More information about the Beginners mailing list