[m-rev.] for post-commit review: warn about bad coerce arities

Peter Wang novalazy at gmail.com
Tue May 28 15:23:47 AEST 2024


On Tue, 28 May 2024 13:14:58 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> On 2024-05-28 12:56 +10:00 AEST, "Peter Wang" <novalazy at gmail.com> wrote:
> > Technically, the user is allowed to name things 'coerce'.
> > It's only 'coerce(Expr)' that is parsed as a type conversion expression.
> 
> Ok, but should we change that? I think we should.
> 

I don't think so. That's how I think "special expressions" like 'apply'
and 'coerce' ought to work. You can name e.g. functions apply/k or coerce/1,
but you cannot call them by writing apply(X, Y) or coerce(X) since those
mean something else. You just need to add parentheses or module qualify
the function name, which seems fair enough, and in line with the rest of
the language.

> > Can we change this error into a suggestion such as:
> > 
> >     A type conversion expression must be written as `coerce(Expr)'.
> 
> That is better wording, except I would end with `coerce(Term)'.
> I will make the change later today.

Thanks.

Peter


More information about the reviews mailing list