137 karma · joined May 24, 2009
Better examples (of actually useful things) would be things like designated initializers, struct literals, declaring array lengths in args using static, etc.
I hesitate to answer your hyperbole about ten variants of equal signs. It's not uncommon for languages to have two notions of equality like ocaml has (or even more): Here's Python for example: http://stackoverflow.com/questions/132988/is-there-a-differe...
To answer your original question of why anyone would prefer to not use startswith: I don't think anyone does.
String.starts_with line "+++"I just looked at TFA and yes, it's truly awful. It doesn't have to be that way. See e.g. https://github.com/m2ym/optima (a pattern matching library for common lisp). I haven't tried it, but I've tried the predecessor of that library.
And in practice, you can come close to the template solution with a macro for the loop. Sure, it will be a little more explicit about which functions are being called, but that's not a bad thing in my book. And, as with the C++, you'll have to build up the equivalent scaffolding and associated code, which I notice is conveniently left out of the C++ examples.h
In lisp you can create sh, python, and C, and mix between them freely within a program/function/block with almost zero friction.
By having a simple universal syntax for all your sub-languages, syntax becomes a non-issue. What in unix may be separate language is just a library in lisp.
This is not a water-tight analogy but I hope it illustrates the point. If you want to really understand I recommend actually digging into a language in the lisp family such as Common Lisp, Racket or Clojure.