3 ms·
What Pike did is creation of language feature. Original post talks about library. Libraries in well-typed languages are of about same power as language feature
by thesz 6y ago
What Pike did is creation of language feature. Original post talks about library.
Libraries in well-typed languages are of about same power as language features and they are within reach of ordinary programmer. If you need a library, you can write it and use and publish. If you need a (change of) language feature, you have to convince others to write that for you.
- bmn__ 6y agoThat claim is false, I just need to bring one counter-example to disprove it. In Perl, regex is a language feature, yet it can be easily supplanted with a library that anyone can use and publish: https://metacpan.org/search?q=re%3A%3Aengine%3A%3A https://metacpan.org/search?q=re%3A%3Aengine%3A%3A It is not necessary to convince the Perl maintainers to write that for you.
- thesz 6y agoYou, from my point of view, disproved nothing. Can you intersperse regexps-as-language-feature with regexps-as-a-library? If answer is "yes", then, I think, you actually proven my point and what is language feature is, actually, a library in disguise. A special kind of library, so to say. If answer is "no", then if you miss something in first thing (an ability to add arbitrary parsing from these libraries, for example) you need to convince language maintainers to work for you, at least, review your work and your proposal.
- ben509 6y agoEven in the OP, the author is already using NSRegularExpression, because Swift doesn't have regular expressions built in. And if Next can write NSRegularExpression, anyone can write their own library that uses a better syntax and that supports interpolation. There's also no reason why a pure library has to make a single string its interface. For instance, in Python I might use overloaded operators: ((R('foo') | 'bar') + 'tholeme' + {'w', 'W'})[1:7] to mean: r'((foo|bar)tholeme[wW]){1,7}' There are some rough edges because you're abusing operator overloading, for sure, but expressing a regex is fundamentally composing assertions with operators. It doesn't _require_ any special syntax. And some languages give you a lot of power to write your own DSLs that will feel more native, e.g. Scheme[1], Haskell[2], Ruby and so forth. [1]: https://docs.racket-lang.org/guide/macros.html https://docs.racket-lang.org/guide/macros.html [2]: https://wiki.haskell.org/Template_Haskell https://wiki.haskell.org/Template_Haskell