11. Alternative Variable Declarations

What

Alternative variable declarations are rejected, e.g.


string|void value = anything();
symbol|term result = UI::UserInput();
integer|string x = 42;

	  

Why

Just about the only situation where this made sense was when a variable might sometimes be nil to indicate some error condition. All other variants of this are of purely academic nature or (more likely) poor programming style. Since all YCP types can be nil now, however, this feature becomes totally redundant. It will very likely be dropped in the near future.

How

The entire YCP code, stripped of comments, is checked for occurences of one of the primitive YCP types (string, integer, boolean, map, list, any, void etc.) followed by a pipe sign | (maybe with whitespace before or after it) and another primitive YCP type.