poke-devel
[Top][All Lists]
Advanced

[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: Fri, 16 Apr 2021 10:21:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Dan.

> I know I'm a bit late to the party since you already pushed the changes,
> but here are my 2cts anyway ;-)

Nah, until we release, we can always change it :)
Thanks for the feedback.

> "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?

Well, it _is_ a comparison...  it implies both a comparison and an
initialization.

b) implies using a syntax emphasizing the initialization aspect.
c) implies using a syntax emphasizing the comparison aspect.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]