[squeak-dev] The Trunk: Compiler-ar.108.mcz

Igor Stasenko siguctua at gmail.com
Tue Dec 22 21:12:02 UTC 2009


2009/12/22 Eliot Miranda <eliot.miranda at gmail.com>:
>
>
> On Tue, Dec 22, 2009 at 5:41 AM, Nicolas Cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
>>
>> Why does this depend on interactive ?
>>
>>       method := self interactive ifTrue: [    methodNode
>> generateWithTempNames ]
>>               ifFalse: [methodNode generate].
>>
>> Nicolas
>>
>
>
> The assumption is that one wants temp names preserved in doits, but is not
> particularly interested in temp names in automatic compiles.  Essentially
> the system is in two modes.  One, with source, does not preserve temp names
> except for doits because the temp names are in the sources files.  The
> other, without sources, converts all methods to sourceless with encoded temp
> names.  But this isn't yet reflected in the code.  The code would better
> read something like
>       method := (self interactive or: [self noSourcesFiles])
>                       ifTrue: [methodNode generateWithTempNames]
>                       ifFalse: [methodNode generate]
> and of course (self interactive or: [self noSourcesFiles]) could be
> extracted into e.g. a class-side method on CompiledMethod or Compiler such
> as
> encodeTempNames: isInteractive
>     ^interactive or: [SourceFiles isNil]
>

ideally, the decision what to do should be delegated to aRequestor, so
code may be something like:

method := methodNode generate: (aRequestor methodTrailerFor: methodNode)

Meanwhile i made own version of Compiler>>evaluate: textOrStream in:
aContext to: receiver notifying: aRequestor ifFail: failBlock logged:
logFlag

which saving a full source code of doit in trailer, if its interactive.

so evaluating given code:
--------------
" doing this"

thisContext method getSource
--------------

prints:

 'DoIt
" doing this"

thisContext method getSource
 '

if you find this useful, i could push change to trunk.


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list