[m-dev.] allowing duplicate field names in module

Peter Wang novalazy at gmail.com
Tue Apr 20 15:14:25 AEST 2021


Hi,

What are the reasons that field names are required to be unique within a
module, and not just within a type?

AFAIK, it's because if the user wanted to supply type/mode declarations
for multiple fields with the same name, the generated functions would
conflict. That doesn't seem like a strong reason to me; the compiler
can just report the conflict.

The reason I'm bringing this up is that it seems annoying to have to
invent new field names when declaring subtypes, though obviously
it's not limited to subtypes.

Peter


More information about the developers mailing list