On 13/05/2011 06:10, KennyTM~ wrote:
On May 13, 11 12:14, Ary Manzana wrote:
<snip>
I didn't use regex a lot before I started using Ruby. The thing is, in
Ruby it's so easy to use regex that I just started using them a lot more
than before. Of course, ruby has built-in operators for matching regexs,
so maybe that should also be added to the language (it's the =~
operator, but in D it should be a different one.)
IIRC it was once there, but very soon removed in the 0.x era (can't find that
changelog).
There was a builtin regexp feature added in 0.147 - I think it was a ~~ or =~ operator
with a string either side. I'm not sure whether it broke too much existing code or was
just thought not right as a language builtin, but it was dropped again in 0.148.
You can't distinguish between division and regex literal in the parser with
this syntax.
And that's half the reason such a syntax has never been implemented in D.
See:
- http://www.digitalmars.com/d/2.0/faq.html#regexp_literals
- http://www.digitalmars.com/d/2.0/regular-expression.html
Which ignores the idea of using a different notation for regexp literals. Though it's
probably not worth much debate when the idea of a built-in regexp type has been rejected
as language bloat.
I think D is going the right way on the whole by leaving regexps to a library. Though
this does limit such possibilities as optimised regexp switches.
Stewart.