Fork me on GitHub

There is a good reason why I can't use promesa.core/extract in ClojureScript, right?

(-> (p/create :a)
    (p/extract)) => No protocol method IState.-extract defined for type object: [object Promise]


js promises don't have the concept of a current value. it can only ever be accessed via .then, which makes all access async even when resolved

🙏 1

Hi folks. This regex works fine for Clojure, but it won’t work when cljs is compiled to js:

Error in browser:
Uncaught SyntaxError: Invalid regular expression: /^v[0-9-a-z]+{2,5}/: Nothing to repeat
I don’t have details on why it is invalid for js, but, in any case, I’m wondering if cljs could warn about it somehow.


I'm surprised it works in CLJ. What is that + supposed to mean? A literal plus?


Sorry, by ’works in cloure I meant “I can evaluate it with no errors”. But this is true of any regex that uses the #{} syntax anyway


So it would fail at runtime anyway, I suppose

Ben Wadsworth17:05:06

Yeah I don’t think you want the + which is adding meaning. you want V and 2-4 digits after?


I don’t have context on the original regex, I was just surprised that people noticed it only after the application did not work at all (because of the error). But I guess it makes sense.

Ben Wadsworth17:05:22

Sorry to be clear, you are saying you want “V” followed by alpha newmerics 1 or more times (the +) then you also want that 2 - 5 times, which doesnt make sense

Ben Wadsworth17:05:04

I am not sure why it works in CLJ… well. I wouldn’t say it “works” but you find a match against any alpha-numeric string following a V, regardless of length

Ben Wadsworth17:05:55

Well I guess it will “find” thats fine, you will just get the first grouping being the v + up to 5 alpha numerics… having the plus there seems to be valid in java land but would change your first match to be any length of digits after the v


May fit whatever cross-platform usecase you may have:


@andre.peric I don't see any practical way to warn about regexes which are a host feature anyway

đź‘Ť 3