This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-16
Channels
- # babashka (53)
- # beginners (61)
- # biff (2)
- # cherry (15)
- # cider (28)
- # clj-kondo (17)
- # clojure (57)
- # clojure-europe (27)
- # clojure-nl (13)
- # clojure-norway (6)
- # clojure-uk (4)
- # clojurescript (30)
- # core-async (2)
- # data-science (39)
- # datomic (16)
- # docker (34)
- # emacs (4)
- # events (1)
- # figwheel-main (9)
- # guix (5)
- # hiccdown (2)
- # honeysql (5)
- # hyperfiddle (5)
- # interceptors (1)
- # jobs (2)
- # joyride (5)
- # lsp (36)
- # midje (1)
- # minimallist (1)
- # nbb (21)
- # off-topic (45)
- # polylith (42)
- # rum (1)
- # shadow-cljs (24)
- # sql (1)
- # squint (62)
- # vrac (1)
- # xtdb (6)
I'm doing the lein-figwheel
quick start to get acquainted with ClojureScript. But I got to the step where I change some code while the server is running and I get this pretty whacky error:
bidi.js:39 Uncaught SyntaxError: Invalid regular expression: /[Ö'-Û¯Ûº-ࣿâ€�-��-�ï¬-ï·¿ï¹°-ﻼ]/: Range out of order in character class
at new RegExp (<anonymous>)
at bidi.js:39:30
Hey Seymore sup?!
The error comes from bidi
, presumably https://github.com/juxt/bidi, but the quick start doesn't mention it and none of the dependencies use it.
Where did it come from?
that's a good question, @U2FRKM4TW. I'd have to do some digging bc it's not in my dependencies either. As far as I can tell I have been following the tutorial to the letter.
This is some kind of localization library as far as I can tell?
What would this be doing if my code is just using plain English characters
It's required by Google Closure library's basic functionality, which is required by CLJS itself. Seems like the way figwheel compiles stuff, it ends up corrupting that RegEx somehow.
Ah, nah - it's the same for me with shadow-cljs. The RegEx itself, that is. But I don't see the same error.
Don't quite understand what's going on, but figwheel's compiled bidi.js
has 'use strict';
at the very top and shadow-cljs' one doesn't.
But also, when the RegExp is loaded it has one text. But when I open it in a separate browser's tab, it has a completely different one. No clue what's going on.
The file evaluated by the browser has this: goog.i18n.bidi.rtlChars_ = "Ö'-Û¯Ûº-ࣿâ€\ud802-\ud803\ud83a-\ud83b" + "ï¬-ï·¿ï¹°-ﻼ";
The very same file but opened in a separate tab has this: goog.i18n.bidi.rtlChars_ = "֑-ۯۺ-ࣿ\ud802-\ud803\ud83a-\ud83b" + "יִ-﷿ﹰ-ﻼ";
Both are valid though when you feed them to new RegExp(...)
in JS console. so my bet is on 'use strict';
.
well I guess I'm glad it's not something dumb I did. Worth opening a PR do you think?
That is what I meant 😅
set the proper charset encoding in your html. <meta charset="utf-8">
usually fixes this
Ah, then it can even become a PR since the quick start tells you what exactly to put into the HTML.
I have an interesting problem here:
https://github.com/clavascript/clavascript/pull/25#issuecomment-1216290062
The existence of a function _PLUS_
in a library seems to affect how the symbol '+
is processed in advanced compilation...
Perhaps it's better to use a set with strings or so, but it's kind of surprising how this manifests...
Rewriting to:
(def infix-operators '#{+ += - -= / * % = == === < > <= >= !=
<< >> <<< >>> !== & | && || not= instanceof})
seems to helpI'd like to do a modify a function in a CLJS lib a little bit, without having to fork said library.
On the JVM I'd just use alter-var-root
for this, but this seems not to be available in CLJS. Are there any alternatives?
Er, sorry, not sure I follow. What do you mean by vendor?
Find the right file in the lib's source code, copy it over to your project into the right directory structure based on its namespace, and then change it. It'll take precedence over the original file during compilation.
aah okay
got it, thanks