[m-rev.] for-post-commit review: add an XXX about possible improvement

Peter Wang novalazy at gmail.com
Tue May 28 16:59:14 AEST 2024


On Tue, 28 May 2024 03:36:47 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For opinions by anyone.
> 
> Zoltan.

> diff --git a/compiler/check_typeclass.m b/compiler/check_typeclass.m
> index aa9c6a845..aa6fc5bfe 100644
> --- a/compiler/check_typeclass.m
> +++ b/compiler/check_typeclass.m
> @@ -2149,6 +2149,14 @@ report_eqv_type_in_abstract_exported_instance(ClassId, InstanceDefn, ArgNum,
>          [words("is an")] ++
>          color_as_incorrect([words("abstract exported equivalence type.")]) ++
>          [nl],
> +        % XXX Should we add this explanatory text? If so, should it be
> +        % in a verbose-only component? Should we add it to reference manual?
> +        % [words("Mercury does not allow this, because allowing it"),
> +        % words("would mean that the code inside the module"),
> +        % words("(which can see the equivalence)"),
> +        % words("and the code outside the module"),
> +        % words("(which cannot)"),
> +        % words("would disagree about the identity of the type.")]
>      report_bad_type_in_instance(ClassId, InstanceDefn, EndPieces,
>          abstract_exported_eqv, !Specs).

I think it should be described in the manual under "Abstract instance
declarations".

I'm still unsure what problem the restriction avoids.
(Or tries to avoid: as check_typeclass.m mentions, the type equivalence
could be hidden in a different module from the instance declaration.)

Peter


More information about the reviews mailing list