Block temps was: Porting from other dialects

Andreas Raab raab at isgnw.CS.Uni-Magdeburg.De
Tue Aug 18 18:51:50 UTC 1998


Folks,

Even though I may spoil a students exercise let me give a comment on the
following:

> Although fudging the compiler to accept block temps and fake them into method
> temps is not too complicated, the problem I never really worked through was
> handling them in the DEcompiler.

It's actually trivial to add block temps to Squeak by patching Parser
statements:innerBlock: with the following (first and last lines show the
context where to apply the patch).

  currentComment _ nil. 
  returns _ false.

  "<---- begin block temps patch ---->"
  hereType == #verticalBar ifTrue:[
      self temporaries do:[:temp|
        stmts addLast: (AssignmentNode new
          variable: temp
          value: (encoder encodeVariable: 'nil')
          from: encoder)]]. 
  "<---- end block temps patch ---->"

  more _ hereType ~~ #rightBracket.
  [more] whileTrue: 


The hidden assignment garantuees that the temp is reset on each activation
of the block. The only problem is that you cannot have the same temp name
in multiple blocks as in:

  [true] whileTrue:[ |tmp| ].
  [true] whileTrue:[ |tmp| ].

But for porting issues that's not really a problem.

  Andreas
--
Linear algebra is your friend - Trigonometry is your enemy.
+===== Andreas Raab ============= (raab at isg.cs.uni-magdeburg.de) =====+
I Department of Simulation and Graphics      Phone: +49 391 671 8065  I
I University of Magdeburg, Germany           Fax:   +49 391 671 1164  I
+=============< http://isgwww.cs.uni-magdeburg.de/~raab >=============+





More information about the Squeak-dev mailing list