[m-dev.] diff: prevent double export

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 24 19:19:05 AEST 1999


On 19-Aug-1999, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> On 18-Aug-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > 
> > The only thing about this diff that needs looking at is that someone who knows
> > the type checker should put in a check that detects double declarations.
> 
> The type checker isn't really the right place to do this; it should be checked
> as it is added to the HLDS. However, it looks like it is a deliberate decision
> to allow multiple declarations:
> 
> <from make_hlds.m:>
...
> 	% We allow more than one "definition" for a given type so
> 	% long all of them except one are actually just declarations,
> 	% e.g. `:- type t.', which is parsed as an type definition for
> 	% t which defines t as an abstract_type.
...
> It would be simple enough to add a check here, but apparently this is
> deliberately not done. Fergus?

Many other languages allow arbitrary numbers of declarations.
At the time, I didn't see any particular need to be different here.

Indeed, I still don't see any compelling need to disallow more than one
declarations, and given that disallowing it now would break backwards
compatibility, I don't think it's really worth it.
But there's certainly nothing wrong with adding a check if the result
of the check is a compiler warning rather than an error.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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