Semantics of $fvis
In introduction.md
@nickm writes:
There is a similar similar
$fvis
that expands to the visibility of the current field.(Since enums variants are always visible, there is no
$vvis
.) TODO: Document${if is_enum { $tvis } else { $fvis }}
.Or maybe change it so $fvis is
pub
for enums? -nickm
The difficulty is that one must use $fvis
when deriving a new type definition. There, $fvis
must vanish for enums. So we have two possible semantics, for which we might provide a template keyword:
In enum, expands to | (nothing) | pub |
---|---|---|
Expansion is | same as written in the driver | synthetic |
Suitable for, e.g. | defining a derived type | defining an accessor function |
Option 1 (current) | $fvis |
${if ...} |
Option 1a | $fvis |
$f_effective_vis * |
Option 2 | ${if ...} |
$fvis |
Option 3 |
$fdefvis * |
$f_effective_vis |
- names TBD obviously.
I think having the expansion mirror what's written in the driver is fairly important. Perhaps important enough to give the more-usually-useful keyword a less-convenient name. So I think I'm leaning towards Option 1a. But I'm quite unsure.