Regex in Swift
benscheirman.com
Regex in Swift
1–10 of 37 posts
Re: Regex in Swift
#2That could be pure correlation. Perhaps it is just coincidence that JavaScript, PHP, Perl, and a handful of others happen to have a lot of "stringly typed" code, message passing using strings as data structures, and an emphasis on string and array operations.
Or it could be that such features, due to their ease of use and the turing-tarpit of powerful enhanced regular expression languages, developers fall into the allure and trap of stringly typed code. And safe languages are the languages that don't make it exceedingly easy to use regular expressions. Because there is no reason you cannot use regular expressions in safer languages like Java, C#, Go, Rust, Haskell, or to be charitable, C++. It just isn't a first-class citizen in those languages.
I'm of the view that if you make your language such that idioms prone to error and bad practices easy, then developers will be prone to error and bad practices.
tl;dr: Even as someone not invested in iOS or OS X development at all, given the chance I'd veto these features. Give me types, not strings.
Re: Regex in Swift
#3Can we add supprt for overloading the comma operator? How about the mail function from PHP?
Re: Regex in Swift
#4There is probably a good reason Swift doesn't have regex literals, regex operators, and other such things. These things are not common in statically, strongly typed languages with an emphasis on safety. That could be pure correlation. Perhaps it is just coincidence that JavaScript, PHP, Perl, and a handful of others happen to have a lot of "stringly typed" code, message passing using strings as data structures, and a…
Re: Regex in Swift
#5"Please tack on this random application-specific feature that I like" Can we add supprt for overloading the comma operator? How about the mail function from PHP?
Swift, among other things, aims to make things less verbose right?
[1]: http://en.wikipedia.org/wiki/Comparison_of_regular_expressio...
Re: Regex in Swift
#6"Please tack on this random application-specific feature that I like" Can we add supprt for overloading the comma operator? How about the mail function from PHP?
Re: Regex in Swift
#7Re: Regex in Swift
#8There is probably a good reason Swift doesn't have regex literals, regex operators, and other such things. These things are not common in statically, strongly typed languages with an emphasis on safety. That could be pure correlation. Perhaps it is just coincidence that JavaScript, PHP, Perl, and a handful of others happen to have a lot of "stringly typed" code, message passing using strings as data structures, and a…
Re: Regex in Swift
#9There is probably a good reason Swift doesn't have regex literals, regex operators, and other such things. These things are not common in statically, strongly typed languages with an emphasis on safety. That could be pure correlation. Perhaps it is just coincidence that JavaScript, PHP, Perl, and a handful of others happen to have a lot of "stringly typed" code, message passing using strings as data structures, and a…
Re: Regex in Swift
#10There is probably a good reason Swift doesn't have regex literals, regex operators, and other such things. These things are not common in statically, strongly typed languages with an emphasis on safety. That could be pure correlation. Perhaps it is just coincidence that JavaScript, PHP, Perl, and a handful of others happen to have a lot of "stringly typed" code, message passing using strings as data structures, and a…
I think the reason is that it's a brand new language that has unimplemented and missing features. Regex as a first-class citizen seems like it absolutely fits into the goals that Swift has and I would be very surprised if its long-term exclusion is intended.
Then again, in Swift you can declare your own operator and call into NSRegularExpression.