[m-dev.] shims

Mark Brown mark at mercurylang.org
Thu Sep 18 00:54:34 AEST 2014


On Tue, Sep 16, 2014 at 10:53 PM, Zoltan Somogyi
<zoltan.somogyi at runbox.com> wrote:
>
>
> On Tue, 16 Sep 2014 19:01:46 +1000, Mark Brown <mark at mercurylang.org> wrote:
>> There's a few points that I hope would mitigate the difficulty of
>> implementation:
>>
>> (1) These constructs are useless without clauses, so they can only be
>> used in the implementation section.
>
> You still have to decide what to do if you find them elsewhere.
>
>> (2) The contents of the branches will be in the implementation section
>> of the sub-module; its interface will only contain generated code,
>> which can be handled specially.
>
> More special handling is exactly what I am afraid of, since it means
> more technical debt.
>
>> (3) If necessary, the items allowed in branches can be restricted,
>> without harming the usefulness of the feature too much. Even if
>> initially just clauses were allowed this would still solve the
>> original problem.
>
> Again, you still have to decide what to do if the imposed restrictions
> are violated. Avoiding an avalanche of error messages caused
> by improper recovery from a previous error is highly desirable,
> but in this case it also looks hard to implement.

Even bailing early instead of trying to recover would still give
better error checking that one would usually expect from conditional
compilation. And I still don't see anything here that's harder than
what has already been done for sub-modules.

I never claimed this solution is free, only that it is interesting.

>
>> Between them, they should mean that, amongst other things, far fewer
>> import_statuses need to be understood.
>
> Unfortunately, just deciding what import_statuses need to be handled
> requires ALL of them to be understood when writing the code :-(

You've already said the invariants are only understood by Fergus, and
yet plenty of developers have committed code involving
import_statuses. Evidently the bar is not set that high in practice.

>
>> I don't think you're joking. I think you are describing exactly what
>> happened when sub-modules were added to the module system. :-(
>
> Yes, exactly.

If you gave this advice to Fergus back then (in 1998), I'm glad he
didn't take it. Otherwise, Mercury might not have sub-modules at all.

Mark.



More information about the developers mailing list