|
| From: | Bruno Haible |
| Subject: | Re: [RFC] A new mechanism to access the active field of unions |
| Date: | Sat, 06 Mar 2021 14:15:09 +0100 |
| User-agent: | KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; ) |
> a2) VAL isa IDENTIFIER
> a3) VAL isa STR
a2 and a3 add new meanings to existing keywords. This route leads
to a hard-to-understand language, as C++ has shown. I would advise
against it.
> c) Like a Use a different keyword instead of `isa' in a2) and a3).
> Maybe `holds'.
>
> PRO: no potential confusion due to the overloading of `isa'.
> CON: introduces a new keyword in the language.
>
> d) Use an attribute syntax instead of a binary operator syntax.
>
> VAL'holds("foo")
>
> PRO: no need to introduce new keyword.
> PRO: can also be applied to structs (more orthogonal)
> CON: in most cases the field name will be constant and it is
> easier to just write an identifier.
I would vote for d. Testing for the existence of a property is not
such an important feature that would warrant an extra keyword.
Bruno
| [Prev in Thread] | Current Thread | [Next in Thread] |