[mercury-users] Type class usage question
Ralph Becket
rafe at cs.mu.OZ.AU
Mon Apr 5 17:18:25 AEST 2004
peter at hawkins.emu.id.au, Monday, 5 April 2004:
> Hi...
> On Mon, Apr 05, 2004 at 02:11:53PM +1000, Ralph Becket wrote:
> > Peter Hawkins, Monday, 5 April 2004:
>
> > The problem with `instance foo(set(int))' is that somewhere else someone
> > might declare `instance foo(set(T))' making it impossible for the
> > compiler to resolve which foo method calls should be made for set(int).
>
> Arguably that should only be an error if someone actually makes such a
> declaration...
If I recall correctly, it's because we support dynamic loading of
modules. Your approach would make it possible to load a module at
runtime that would make ambiguous the semantics for a previously
unambiguous program.
> What's the recommended workaround? Wrap it in a discriminated union
> type?
'Fraid so! It's usually not a big deal.
-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list