[squeak-dev] The Trunk: Kernel-mt.1119.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Nov 22 21:12:00 UTC 2017


2017-11-22 9:11 GMT+01:00 Marcel Taeumel <marcel.taeumel at hpi.de>:

> Hi Nicolas,
>
> it won't. :) The "super" is local to "Class" and will dispatch to
> "Behavior", not your domain-specific instance of "Class" (resp.
> "Behavior"). So, if a tool, say System Browser, calls "Bar class
> compilerClass", the following thing happens:
>
>
Thanks, it's clear now
A method invoking super will put the binding where the method is
implemented in last literal
Then this last literal will be used for starting the super lookup
IOW the super lookup starts in superclass of last literal of
(Class>>#metaCompilerClass)
I allways bug when we invoke super with a different selector, but worse, I
forget that I bug :)

Metaclass >> compilerClass
> Bar class (Class) >> metaCompilerClass
> Bar class (Behavior) >> compilerClass
>
> Only if you add a #metaCompilerClass to the class-side of Bar, then the
> look up changes to:
>
> Metaclass >> compilerClass
> Bar class  >> metaCompilerClass
>
> Consequently, #compilerClass and #metaCompilerClass are not interfering in
> terms of inheritance.
>
> Best,
> Marcel
>
> Am 21.11.2017 16:24:09 schrieb Nicolas Cellier <nicolas.cellier.aka.nice@
> gmail.com>:
>
>
> 2017-11-09 11:13 GMT+01:00 <commits at source.squeak.org>:
>
>> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-mt.1119.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-mt.1119
>> Author: mt
>> Time: 9 November 2017, 11:13:37.82048 am
>> UUID: a210d4c7-b8eb-e544-a857-2b0bbade9668
>> Ancestors: Kernel-mt.1118
>>
>> Improves support for having custom compiler classes for class-side
>> methods. No need to use #respondsTo:. Just provide default implementation
>> of #meta*Class methods in Class. The "super" is important here because the
>> old behavior has been to  use a custom compiler for the instance-side only.
>>
>> =============== Diff against Kernel-mt.1118 ===============
>>
>> Item was added:
>> + ----- Method: Class>>metaCompilerClass (in category 'compiling') -----
>> + metaCompilerClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super compilerClass!
>>
>>
> in that case:
> Object subclass: #Foo. Foo class >> compilerClass ^FooCompiler.
> Foo subclass: #Bar. Bar class >> compilerClass ^FooBarCompiler.
>
> Won't the FooCompiler be used for compiling Bar class side methods?
> (though I have never overriden any metaCompilerClass)
>
> Item was added:
>> + ----- Method: Class>>metaDecompilerClass (in category 'compiling') -----
>> + metaDecompilerClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super decompilerClass!
>>
>> Item was added:
>> + ----- Method: Class>>metaEvaluatorClass (in category 'compiling') -----
>> + metaEvaluatorClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super evaluatorClass!
>>
>> Item was added:
>> + ----- Method: Class>>metaFormatterClass (in category 'printing') -----
>> + metaFormatterClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super formatterClass!
>>
>> Item was added:
>> + ----- Method: Class>>metaParserClass (in category 'compiling') -----
>> + metaParserClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super parserClass!
>>
>> Item was added:
>> + ----- Method: Class>>metaPrettyPrinterClass (in category 'printing')
>> -----
>> + metaPrettyPrinterClass
>> +       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> +
>> +       ^ super prettyPrinterClass!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>compilerClass (in category 'compiling') -----
>>   compilerClass
>> +
>> +       ^ self theNonMetaClass metaCompilerClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaCompilerClass)
>> -               ifTrue: [self theNonMetaClass metaCompilerClass]
>> -               ifFalse: [super compilerClass]!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>decompilerClass (in category 'compiling') -----
>>   decompilerClass
>> +
>> +       ^ self theNonMetaClass metaDecompilerClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaDecompilerClass)
>> -               ifTrue: [self theNonMetaClass metaDecompilerClass]
>> -               ifFalse: [super decompilerClass]!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>evaluatorClass (in category 'compiling') -----
>>   evaluatorClass
>> +
>> +       ^ self theNonMetaClass metaEvaluatorClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaEvaluatorClass)
>> -               ifTrue: [self theNonMetaClass metaEvaluatorClass]
>> -               ifFalse: [super evaluatorClass]!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>formatterClass (in category 'printing') -----
>>   formatterClass
>> +
>> +       ^ self theNonMetaClass metaFormatterClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaFormatterClass)
>> -               ifTrue: [self theNonMetaClass metaFormatterClass]
>> -               ifFalse: [super formatterClass]!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>parserClass (in category 'compiling') -----
>>   parserClass
>> +
>> +       ^ self theNonMetaClass metaParserClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaParserClass)
>> -               ifTrue: [self theNonMetaClass metaParserClass]
>> -               ifFalse: [super parserClass]!
>>
>> Item was changed:
>>   ----- Method: Metaclass>>prettyPrinterClass (in category 'printing')
>> -----
>>   prettyPrinterClass
>> +
>> +       ^ self theNonMetaClass metaPrettyPrinterClass!
>> -       "BE CAREFUL!! If you provide your own class to treat class-side
>> (resp. meta) methods, you MUST account for the #meta*Class selector to use
>> the default implementation in that case. That is, the methods behind
>> #meta*Class MUST always get the default Smalltalk treatment."
>> -
>> -       ^ (self theNonMetaClass respondsTo: #metaPrettyPrinterClass)
>> -               ifTrue: [self theNonMetaClass metaPrettyPrinterClass]
>> -               ifFalse: [super prettyPrinterClass]!
>>
>>
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171122/2adefcde/attachment.html>


More information about the Squeak-dev mailing list