[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] struct field initialization and implicit constraints
From: |
Dan Čermák |
Subject: |
Re: [RFC] struct field initialization and implicit constraints |
Date: |
Thu, 15 Apr 2021 20:40:31 +0000 |
Hi Jose,
I know I'm a bit late to the party since you already pushed the changes,
but here are my 2cts anyway ;-)
"Jose E. Marchesi" <jemarch@gnu.org> writes:
> 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?
I must admit that I do not like c) too much, as it looks like a
comparison to me. I'd suggest to use either b) or maybe add something
like a decorator?
Cheers,
Dan
signature.asc
Description: PGP signature