Fork me on GitHub
#squint
<
2022-08-17
>
Cora (she/her)01:08:30

hmmm not sure how to check out tree-shaking to see what it's doing

borkdude07:08:34

npx esbuild <compiled-script.mjs> --bundle --minify --platform=node --outfile=dist/index.mjs --format=esm

👍 1
didibus02:08:03

I'm wondering if a separate compiler is needed, or just an alternate cljs.core? If you subbed a cljs.core where hashmap created a JS object, list a JS array, etc. And it made no use of Google Closure. Wouldn't that give the same result?

borkdude06:08:14

@didibus Yes, the compiler core can be the same between cherry and clavascript, with minor differences

borkdude06:08:49

There will also be differences between macroexpansion of doseq etc, so it's not just the core lib that will be different

borkdude15:08:48

What do you people think of the name clavascript: alright, or too lame?

Aleed15:08:02

Alternative: Cloja, or Clojascript

borkdude15:08:23

Hmm, then I'd prefer clava still :)

Cora (she/her)15:08:34

Clojure#, imo troll

lol 1
lilactown15:08:15

the only reason I would want to think of alternatives is that it's too close to #calva

✔️ 2
borkdude15:08:58

Yeah, I don't find this a problem since it's a totally different thing

borkdude15:08:23

and the full name clavascript should be enough to disambiguate

lilactown15:08:49

does clava mean something?

borkdude15:08:11

I looked it up and I saw something about fungus . This wasn't intentional though :)

Cora (she/her)15:08:55

how about some kind of riff on cherry?

Cora (she/her)15:08:24

like berry or something

borkdude15:08:44

What I intend with the name clavascript: it's inspired (and built) with CLJS but the semantics are JavaScript (use the platform, no custom datastructures that you have to convert between when doing interop). I think with that in mind, the name makes sense. Just wanted to double check if clavascript wasn't too lame.

borkdude16:08:06

Luckily the github org and npm name were still available ;)

Cora (she/her)16:08:46

you could call it blossom

Cora (she/her)16:08:50

so we have cherry and blossom

lilactown16:08:05

not too lame for me. might not be saying much tho

Cora (she/her)16:08:59

are we trying to stick with fruit? 😜

lilactown16:08:53

:clvs isn't an awful reader cond either, although pretty close to :cljs

borkdude16:08:21

yeah and .clvs is also a nice file extension (although we could just do .clava too

borkdude16:08:59

Alright, sticking with clava for now, thanks for the input ;)

borkdude16:08:16

What about the name licorice? lilactown + cora + hmm, it doesn't make sense beyond that ;)

😂 2
lilactown16:08:41

I do love licorice (to the chagrin of everyone who spends a large amount of time with me, they all hate it)

Cora (she/her)16:08:27

and I hate it 😂

Cora (she/her)16:08:39

and we all have a love/hate relationship with js

didibus16:08:49

What about CavaScript ? And Cava means wine.

borkdude16:08:56

that name was already taken in several places, this is how I got to clavascript

borkdude16:08:38

I guess the good thing about clavascript is that it's a unique name and you will hit the right github repo when you search for it

Cora (she/her)16:08:24

you could name it cloy 🤪

didibus16:08:29

Fair enough.

gdubs20:08:36

Typescript is a language and tscis a program that converts typescript to javascript (I think). Does Clavascript refer to the language or the program? Traditionally, I consider javascript, typescript, coffeescript, actionscript, applescript, all refer to the language/syntax. I consider cherry, shadow-cljs, nbb, etc, refer to the program. But I think here, it's still just 'clojurescript', right? And Clavascript is the program? If so, I think that's a departure from convention.

borkdude20:08:38

No, clavascript is the language :) It's a dialect of CLJS which transpiles directly to JavaScript's built-in data structures. The program is called clava .

👍 1
didibus03:08:00

Do you think there'll be any way to share code between Clojure and ClavaScript in cljc files? Or will the semantics end up so different probably not?

borkdude05:08:17

Yes, we could, if we introduce :clavascript/clvs or so

borkdude15:08:42

Since Clava is based on mutable native data structures, it might be a nice language to do Advent of Code in (and then compare performance against regular CLJS would be interesting too). Also, doing those Advent of Code puzzles might be a nice way to detect bugs in Clava :)

💯 2
borkdude16:08:15

Published a new version to npm, also to playground:

🎉 1
lilactown16:08:58

you're so fast on merging and responding to PRs 😄

lilactown16:08:17

I hope that I'm not making you feel pressured

borkdude16:08:18

Not at all, I appreciate your contributions a lot!

lilactown16:08:16

tbh I've been thinking about something like clavascript for a long time. you've built a beautiful foundation for me to play with 🙂 I appreciate the work you've put into building all of that and how open you are to collaborate

borkdude16:08:53

I'd be happy to add you as a core team developer since you've contributed some pretty awesome core ideas to the core library

lilactown16:08:12

I'll still expect to wait until one of you review my changes before I merge a PR

1
borkdude16:08:49

Yes, let's do that. I just love the idea of clava being a we thing instead of a me thing

👍 1
borkdude16:08:20

I'll add you to the github org after dinner

💜 2
borkdude18:08:01

I've moved cherry to the github org now and will pull out the common compiler parts so they can be re-used (and things will work consistently between the two: jsx, etc)

pizzaspin 1
borkdude20:08:38

@U4YGF4NGM @corasaurus-hex Hmm, part of me wants to keep the compiler just as it is now, since we can then freely make changes to everything in either cherry or clavascript, but bug fixes in the compiler namespace will have to be made twice.

Cora (she/her)20:08:09

would it make sense to keep them separate for a while until we flesh out the languages more and then see how best to merge them (or not merge them) later

borkdude20:08:59

or we could have a goog-define thing that says: I'm using this from cherry or clava and then do something different based on that, or perhaps a macro or so

borkdude20:08:17

Perhaps applying bug fixes twice isn't that bad

Cora (she/her)20:08:41

if we merge them then it's only a few more steps until we have a clojure-ish language toolkit 😅

Cora (she/her)20:08:35

we can wait until bug fixes are painful across them? Im a fan of delaying work until we're sure we want to do it (or sure we want to spike on it)

borkdude20:08:47

yes, the voice of reason!

💜 2
Cora (she/her)20:08:30

feels like it might be smart to plan for interop to make plan a little for the immutable data structures coming to js eventually here

borkdude20:08:35

Not sure what to do about those. I think similar to #map {:a 1} we could support #immutable-map {:a 1} (with a shorter name) and add support to assoc and friends to return another immutable version (but perhaps this will already work since those TC39s will support the spread stuff?)

borkdude21:08:11

And btw, this is just a proposal right now, there's still a change that it won't make it and it will take a long time before we will probably see this "everywhere"?

Cora (she/her)21:08:53

still a chance, for sure. my understanding is that it's likely but still tentative.

Cora (she/her)21:08:01

I can't remember where I learned that ... maybe my brain just really wants it to be true

Cora (she/her)21:08:13

I like going the same route as map

Cora (she/her)21:08:33

#rec and #tup or something

borkdude21:08:06

sounds good

Cora (she/her)21:08:40

is undefined something we want to represent in the language? the distinction between nil and undefined can matter sometimes

Cora (she/her)21:08:48

it might especially matter for interop

borkdude21:08:40

$ ./node_cli.js -e '(println js/undefined)'
undefined
🤷

Cora (she/her)21:08:10

oh, js/undefined, cool

borkdude21:08:42

even undefined works, but js/undefined works better with clj-kondo, etc and is standard CLJS syntax

Cora (she/her)21:08:38

it's been so long since I used cljs, this is great to know

borkdude22:08:54

Now working on JSX again. I think I've got the right approach this time:

$ ./node_cli.js --no-run --show -e '(defn App [] (let [x 1] #jsx [:a {:href x} "dude"]))'
var App = function () {
let x1 = 1;
return <a href=x1>"dude"</a>
;
};

export { App }
The only thing here is, when should we emit { x1 } - we could try to "autodetect" this since in CLJS you will use strings instead of symbols for raw text anyway. On the other hand, being explicit is more in line with that JSX does:
(defn App [] (let [x 1] #jsx [:a {:href ~x} "dude"]))
E.g. we could use ~ to escape the JSX-mode. I'll have to play around with this. Off to bed now.