[m-users.] Why can't there be multiple field constructor field names in the same module?

Philip White philip at pswhite.org
Thu Oct 14 11:55:47 AEDT 2021


I'm getting an error like "field abc multiply defined" for type
definitions like the following:

:- type x ---> x(abc :: int).
:- type y ---> y(abc :: int).

The error is quite clear, so I'm not confused what it's complaining
about; I'm just confused *why*. Is there a fundamental reason that
having fields with the same name in the same module is unacceptable, or
has no one yet implemented support for it?

It seems unfortunate if I have to prefix field names with the name of
the type. For example,

:- type x ---> x(x_abc :: int).
:- type y ---> y(y_abc :: int).

If I have to do this for some fields, I would almost want to do it for
all of them, for consistency's sake.

Thanks,
Philip


More information about the users mailing list