4 ms·
> two things which Swift does support For some value of "support". If you mean compared to C, yes it has pattern matching. If you mean compared to what Haskel
by rdtsc 11y ago
> two things which Swift does support
For some value of "support". If you mean compared to C, yes it has pattern matching. If you mean compared to what Haskell, Erlang or Elixir has, not as much.
The author is one of the creators of Erlang so from his point of view pattern matching is severely lacking.
I have used Erlang, Python, C#, C++, Java and yes, I though Python had pattern matching compared to Java. But then used Erlang and realized that Python doesn't have pattern matching ;-)
It is one of those things that once you use it, it is very easy to notice when it is lacking.
- masklinn 11y ago> yes, I though Python had pattern matching compared to Java. Python doesn't have pattern matching at all though, and doesn't advertise such a feature. It has iterables unpacking.
- rdtsc 11y agoYou are right. I was saying that coming from C, it seemed like pattern matching and a really cool feature. Until someone found how pattern matching works in Erlang or Haskell. Even in Python to its credit, iterable unpacking pretty nifty. It can now even do stuff like: https://www.python.org/dev/peps/pep-3132/ https://www.python.org/dev/peps/pep-3132/ >>> a, *b, c = range(5) >>> a 0 >>> c 4 >>> b [1, 2, 3]