[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] struct field initialization and implicit constraints
From: |
Jose E. Marchesi |
Subject: |
Re: [RFC] struct field initialization and implicit constraints |
Date: |
Mon, 12 Apr 2021 21:10:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi.
> So, how to fix this.
>
> I see three possibilities:
>
> a) Do nothing, and document the workaround in 1).
>
> b) Add a new syntax like `:= VALUE' to mean initialization-only, and
> keep the current semantics of `= VALUE'.
>
> c) Change the semantics of `= VALUE' to mean initialization-only, and
> add a new syntax like `== VALUE' to always mean
> initialization-and-implicit-constraint.
>
> In this case, using `== VALUE' would forbid to also specify an
> explicit constraint, i.e. this would not be permitted:
>
> type Foo =
> struct
> {
> uint<16> magic == 0xfeef : magic > 0; /* error */
> [...]
> };
>
> My preference at this point is c).
> Opinions?
Since there has been no feedbad in a few days I just pushed an
implementation for c) that I had ready before hand. It is now in master
:)
Salud!