question for ClojureScript devs re: regex equality

108 views
Skip to first unread message

Stuart Halloway

unread,
Apr 12, 2013, 10:24:33 AM4/12/13
to cloju...@googlegroups.com
I propose that for consistency with Clojure, ClojureScript use identity-based equality for regular expressions, per [1], but other people clearly think the opposite, so please make your case.

Herwig Hochleitner

unread,
Apr 12, 2013, 11:11:42 AM4/12/13
to cloju...@googlegroups.com
Could you explain the undecidability, you mentioned in the ticket? Do you mean equality as in two distinct regex strings describing the same grammar (which the cljs version doesn't seem implement either)?
Intuitively, this concept of equality doesn't seem undecidable to me, since regular expressions are just (possibly infinite) concatenations. Indeed, I've found a paper to back up this view: http://cs.simons-rock.edu/cmpt320/ginzburg.pdf
I would certainly not recommend to implement this concept of equality (let's call it real equality), on top of host regexes.
It might be an option for a clojure native regex library.

Concerning masquerading string equality as regex equality (as cljs currently does), I'm fine with reverting to identity based equality, since I don't see any legitimate uses for regexes as identifying keys.
Also your point about host complexity is already evident in the cljs impl: It considers regexes equal, that are not, because of regex flags.

Reply all
Reply to author
Forward
0 new messages