[Pharo-project] Issue 3525 in pharo: Compiler>>parserClass is broken and does not querying the class for providing the parser class
eliot.miranda at gmail.com
Mon Jan 10 15:32:53 EST 2011
On Mon, Jan 10, 2011 at 11:42 AM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:
> Will it work ?
> because Compiler class>>new
> ^ super new parser: self parserClass new
> sets the parser ivar with Compiler parserClass new.
> Maybe you'll need to remove this definition of new too.
I think it works. Behavior>>parser class gets compilerClass parserClass:
"Answer a parser class to use for parsing method headers."
^self compilerClass parserClass
So one is supposed to implement a Compiler subclass that defines a
class-side parserClass method. e.g.
^parser ifNil: [(class ifNil: [self class]) parserClass] ifNotNil: [parser
will also find MySpecialParser.
Yes, its heavyweight because the Compiler subclass isn't providing anything
other than the reference to the parser. But that's the way the system is
written so far.
what do you think?
> 2011/1/10 Eliot Miranda <eliot.miranda at gmail.com>:
> > On Mon, Jan 10, 2011 at 9:46 AM, <pharo at googlecode.com> wrote:
> >> Status: Accepted
> >> Owner: siguctua
> >> New issue 3525 by siguctua: Compiler>>parserClass is broken and does not
> >> querying the class for providing the parser class
> >> http://code.google.com/p/pharo/issues/detail?id=3525
> >> In the following:
> >> Compiler>>parserClass
> >> ^parser ifNil: [self class parserClass] ifNotNil: [parser class]
> > Who writes this stuff ?? ;)
> > <blush>
> > I suggest the attached:
> > parserClass
> > ^parser ifNil: [(class ifNil: [self class]) parserClass] ifNotNil:
> > class]
> >> 'self class' should actually be 'class parserClass'
> >> So, any class could override the default parser by own. In that way a
> >> default parser class is answered by Behavior, not by Compiler.
> >> A Compiler class>>parserClass is useless.
> >> But even more than that, due to initializing 'parser' ivar in
> >> Compiler>>new,
> >> it never gets to that code, and evaluating 'parser class'
> >> So, a class can't specify a custom parser class to compiler.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev