Open dumblob opened 9 years ago
I don't think it's a good idea. It would be type mangling which may easily lead to errors. If this functionality is deemed important, I'd rather welcome a dedicated operator which accepts a condition and a value of type @T
, yielding @T|none
.
We already have some support for auto-conversion of disjoint union types containing
none
, but the ternary operator doesn't support it. Right now, the following will check type in runtime:but the following will throw an error in compile time:
Note, that the
href
named argument ofanchor
currently accepts onlystring
, which might change based on the issue https://github.com/daokoder/dao-modules/issues/78 .