Repository navigation
|
Dear Fabonicci, please compare the implementation of your matcht Statement with the implementation in PHP. I find the underscore for the default case not so good and we should use the keyword 'default'. Please think also to TTS-Models. |
Replies: 1 comment 2 replies
|
Both spellings already exist. There is a reason match p of
(0, _): writeln('on Y axis');
(_, 0): writeln('on X axis');
'w', 'a', _: writeln('w, a, or anything else');
end;Inside a tuple pattern They also differ in One more practical point: On the PHP comparison: PHP |
Both spellings already exist.
_is the wildcard,elseis the no-match fallback, andotherwiseis a synonym ofelse. So if you dislike the underscore, writeelseorotherwiseand you get exactly whatdefaultwould give you. Addingdefaultwould be a third spelling of something that is already there twice.There is a reason
_is not just cosmetic sugar forelse._is a pattern, not a clause, and it goes where a clause cannot:Inside a tuple pattern
_means "ignore this field", and it can also close a comma-separated pattern list.defaulthas no meaning in either …