[m-dev.] RTTI & breaching the abstraction barrier
Ralph Becket
rbeck at microsoft.com
Tue Feb 6 03:13:13 AEDT 2001
This has been bugging me for a while, so I thought I'd mention it.
The type reflection stuff in std_util allows a programmer to pick
apart an object whose composition would normally be hidden because
the object's type is abstract.
What's worse, it seems that a sneaky programmer can also construct
objects of the abstract type and place them in circulation. This
can cause problems. For instance, set/1 is an abstract type
implemented as an ordered list; using construct/3 I can create an
instance of set/1 that does not satisfy this property.
Admittedly this would be an odd thing to do, but it is a hole.
Is this a hole to be plugged (I'd be interested in the mechanism)
or a necessary evil? [Disclaimer: I think RTTI is a Good Thing!]
--
Ralph Becket | MSR Cambridge | rbeck at microsoft.com
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list