[m-rev.] for post-commit review: new pragma type_order_switch
Julien Fischer
jfischer at opturion.com
Wed Jun 18 15:17:27 AEST 2025
On Wed, 18 Jun 2025 at 15:14, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
>
>
> On Wed, 18 Jun 2025 15:01:10 +1000, Julien Fischer <jfischer at opturion.com> wrote:
>
> > On Tue, 17 Jun 2025 at 23:35, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> > >
> > > I intend to use this new pragma to ensure that the order
> > > of the clauses of the optdb predicate matches the order
> > > of the options they describe in the option type.
> > >
> > > The implementation is straightforward, and thus does not
> > > really need review. The questions I would like reviewers
> > > to look at are:
> > >
> > > Is this pragma useful generally enough to be publicly documented?
> >
> > I think so. Would it be more useful as a scope around a switch, rather
> > than a pragma on the predicate.
>
> That was my first thought as well. But that does not work when the switch
> is constructed not from an explicit disjunction, but the disjunction implicit
> in a whole bunch of clauses. And in this case, unlike many others, I think
> clauses are preferable to an explicit disjunction.
Good point, I didn't think of that.
...
> > > Can anyone think of a better name for the pragma?
> >
> > In line with other pragmas / scopes, it probably wants to be
> > "require_" something.
> > Perhaps, "require_switch_type_order"?
>
> How about require switch_arms_in_type_order? A bit longer,
> but a lot more descriptive.
Sure, that works.
> > > Can anyone think of any way to improve the wording of the
> > > warning message?
> >
> > Not so much an improvement, but don't we refer to "cases" as "arms"
> > elsewhere?
>
> I know we do, but I think we may refer to cases as well. I will have a look
> at the manuals, and act according to what I find.
I was going off the fact that we have scopes whose names refer to switch arms.
Julien.
More information about the reviews
mailing list