On Mon, 4 Mar 2019 at 20:08, Norbert Hartl <[email protected]> wrote:

>
>
> > Am 04.03.2019 um 03:46 schrieb Ben Coman <[email protected]>:
> >
> > 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' ]
> >
>
> Isn’t the usual way to do that to register the class in the shutdown list
> and implement #shutdown: ?
>

To me a good minute to work out why I didn't understand you.
Sorry, I meant <onMethodSaveResetVariable: ReferenceData>

So when 'reference data' is updated and the modified method is saved,
the variable gets lazy initialized *again* with the new definition.

hope that is more clear,
cheers -ben

Reply via email to