[squeak-dev] The Trunk: Compiler-ar.108.mcz
Eliot Miranda
eliot.miranda at gmail.com
Tue Dec 22 21:52:54 UTC 2009
On Tue, Dec 22, 2009 at 1:12 PM, Igor Stasenko <siguctua at gmail.com> wrote:
> 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)
>
Except that aRequestor could be nil.. In fact I could also imagine that a
sourceless system wouldn't necessarily want to encode temp names (for space
and speed) in a sealed application. So the choices are
if interactive always encode with sources
if not interactive
if sources do not encode (temps in source)
if not sources defer to a preference
And set the preference to true when doing abandonSources.
>
> 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.
>
I don't know. Keeping temp names is adequate when doing doits for me. If a
doit gets big enough to need a comment it probably needs to be a proper
method ;) But what do others think?
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20091222/e65434b3/attachment.htm
More information about the Squeak-dev
mailing list
|