[Newbies] Re: optimization (2nd attempt)

nicolas cellier nicolas.cellier.aka.nice at gmail.com
Mon Nov 25 23:53:40 UTC 2013


paolo.bernardi.67 <at> gmail.com <paolo.bernardi.67 <at> gmail.com> writes:

> 
> Sorry, I'm not so smart when quoting...
> 
> Il 24/11/2013 15.39, Levente Uzonyi wrote:
> 
> > Since message sends are late bound, it means that if you want to cache
> > something, then you have to do it yourself.
> 
> I know (or I think I know) what late binding means,
> but I can't figure the connection with the topic of caching the return
> value.
> In other words: if st was NOT late binding, things were different about
> the to cache or not to cache some return value?
> Can you clear to me the idea?
> 
> molte grazie (= many thanks)
> 


As Levente said it: the implementation of Time could change entirely, such
that previous instance of Time could loose their meaning (for example, you
add/removed/renamed some instance variables, or changed expected interface
for those inst. var.).

If Time can change, then you'd better not create potentially obsolete
instances in advance.

If you have a version of asTime that you can guaranty unchanged, then you
can perform early binding, that is immediately evaluate the message send to
the constant, and hardcode the result of message sent as another constant...

But even with such early binding, things could go tricky, what should this
respond?

^'6:30am' asTime class allInstances size



More information about the Beginners mailing list