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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Marcin Tustin
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 <[hidden email]> 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 < [hidden email]> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> _______________________________________________
       Mth



_______________________________________________


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners