Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 4232 days ago | link | parent

Random thought on my way home today: I get the name ~= for inequality, but it's awfully similar to Perl's =~ for regular expression matching. I don't know if that's a deal-breaker, though. My most-used languages don't actually have the =~ operator, but I do get a little "syntax envy" for it. So I think it's cool that there promises to be support for an infix =~, regardless.

(I started this post thinking that the RE-matching operator was ~=, but then I looked it up. Everything went better than expected.)



1 point by akkartik 4232 days ago | link

Yeah, I considered the issue of perl[1]. I might use =~, but I'll probably not use =~ for regex match if I use ~= for inequality. Different things should look different, and all that. The simple option would be to just use match like in javascript. But maybe something else will present itself. Maybe just define equality between regex and string as match?

  let r (regex "a.*")
    if ("abc" = r)
      ..
[1] See the commit message at http://github.com/akkartik/wart/commit/f0e3d726eb

-----

2 points by Pauan 4232 days ago | link

I like that idea. You're testing whether the regexp is "equal to" the string. But I'd put the regexp first, like (r = "abc")

-----