[Pharo-dev] managing modification of class initialization methods

Ben Coman btc at openinworld.com
Sun Mar 3 21:46:37 EST 2019

In relation to developing sample solutions for an Exercism exercise, the
following observation was made about class initialization...

> class is initialized on load - and not when you modify it - so this can
be very confusing for users

My first thought was to wonder if Quality Assistant could track whether a
class initialize method had been run after it was modified,
and display alerts.

Alternatively, I wonder if a reasonable pattern would be to
couple class-side lazy initialization
with a pragma to reset a variable when the method is saved...

    MyClass class >> referenceData
        <onSaveResetVariable: ReferenceData>
        ^ ReferenceData := ReferenceData ifNil: [ 'reference data' ]

cheers -ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20190304/d13cac50/attachment.html>

More information about the Pharo-dev mailing list