The Trunk: Kernel-mt.1119.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-mt.1119.mcz

commits-2
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!

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]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1119.mcz

Nicolas Cellier


2017-11-09 11:13 GMT+01:00 <[hidden email]>:
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]!





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1119.mcz

marcel.taeumel
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:

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 <[hidden email]>:



2017-11-09 11:13 GMT+01:00 <[hidden email]>:
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]!