Rahul Jain <[EMAIL PROTECTED]> writes:

> Nicolas Neuss <[EMAIL PROTECTED]> writes:
> 
> > P.S.: Somehow the philosophy behind the structure slot-accessors is
> > wrong (or better, quite low-level, a replacement for not having type
> > declarations everywhere).  If I write struct1-dimension everywhere in
> > my program I cannot easily exchange struct1 against struct2.  On the
> > other hand, I can do that with generic functions.  Unfortunately,
> > generic functions are slow, therefore I want to transform them away
> > when declaring the type of an argument at the beginning of some
> > function.
> 
> The reason g-fs are slow is exactly what you explain here. Because
> struct accessors know exactly where the slot is in the data structure,
> they can get it quickly. g-fs must dispatch to the proper slot-value
> accessor for the class of the object passed in. That's about as
> optimized as you can get unless you declare that the class is sealed;
> in which case, you might as well use structs.

What I don't like about structs is that their accessors expose
unnecessarily implementation details (when I write struct1-dimension I
know that the object is a struct1) thus contradicting proper
information hiding.  Therefore, I have put a generic function layer
around my structures.  Now, I want to make this type of access fast if
sufficient information is available to the compiler.

Nicolas.

Reply via email to