[NIT] Pretty pretting #ifFalse:ifTrue:
Bijan Parsia
bparsia at email.unc.edu
Mon Nov 19 22:04:45 UTC 2001
On Mon, 19 Nov 2001, Stephan Rudlof wrote:
> Bijan Parsia wrote:
[snip]
> > But so is:
> >
> > testPPIf: aBool
> > aBool ifTrue:[^5]
> > ifFalse:[^nil]
> >
> > (ok, perhaps only in this simple example).
> >
> > And in that case PPing gets:
> >
> > testPPIf: aBool
> > aBool
> > ifTrue: [^ 5]
> > ifFalse: [^ nil]
There are too many examples. Which is *my* fault! :)
> Fully correct!
>
> *Wrong* would be
> testPPIf: aBool
> aBool
> ifTrue: [^ 5]
> , since this would return self.
Yes, but I didn't *want* that :) My point is that only very specific
equivalences are transformed (the ^...ifTrue:..ifFalse[nil] but not the
^...ifTrue: [^...] ifFalse: [^...] was transformed(, whereas others are
not. This is for a good reason, of course. That reason being that the
compiler doesn't *make* those other transformations. But this ties the
pretty printer to specific features of the compiler which can easily
change.
Imagine hooking up the pretty printer to the Refactoring Browser's
parsing/lint mechanism so that *pretty printing* would produce
refactorings! That might actually be *useful* for checking out what a
refactoring would do to the code, but I sure wouldn't want to call it
pretty printing :) (of the original code).
Cheers,
Bijan Parsia.
More information about the Squeak-dev
mailing list
|