Le lun. 4 mars 2019 à 03:47, Ben Coman <btc@openinworld.com> a écrit :
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' ]
On Mon, 4 Mar 2019 at 14:52, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
Hi Ben, It's probably time to revisit
http://smallissimo.blogspot.com/2011/08/lazy-initialization-of-shared-variab...
Interesting stuff, but after ten minutes studying it I didn't fully grok it. So my first impression is its too much magic and I couldn't isolate what is required of a simple user. For comparison, could you show what a user would need to do to duplicate my example using that system, assuming the background magic was in place. cheers -ben