TSa Thomas.Sandlass-at-vts-systems.de |Perl 6| wrote:
HaloO,

Matthew Walton wrote:
If a user of your API contrives to make it change while you're
running, that's their own foot they've just shot, because they can
look at the signature and know the semantics of the parameter passing
being used and know that if they change the value externally before
you return Bad Things Could Happen.

I agree that the caller is responsible for the constness of the value
he gives to a function. With this we get the best performance. I don't
understand why John thinks that an intermediate proxy is needed. A very
shallow wrapper that ensures the readonlyness suffices. Most of the
time not even that when the constness is known statically.


Regards TSa.
"shallow wrapper" is what I'm talking about. That is indeed a proxy: if a full-blown run-time check is needed (when it gets passed beyond its ability to track at compile time) it forwards methods, intercepts others, and modifies accessors.

Reply via email to