Fork me on GitHub
#cherry
<
2022-10-24
>
jose15:10:47

any thoughts on adding support for ES6 classes? class syntax is required to create custom elements (web components), something I'm missing in ClojureScript

borkdude15:10:15

Right now I think you can accomplish this using deftype?

jose15:10:03

I think that's not enough to create a custom element, and for that reason shadow-cljs added the defclass macro. At least that's my understanding

borkdude15:10:41

David asks for something at the end of that issue.

borkdude15:10:26

I'm willing to consider it, you can open an issue, but not sure when I will get to it since I also need to consider the pros/cons. You could also decide to implement that custom type in JS and then use it from cherry

borkdude15:10:38

There is also a js* special form that might help

borkdude15:10:07

$ ./node_cli.js -e '(js* "class Foo {}") (prn (new Foo))'
#object[Foo [object Object]]

jose15:10:29

thanks @borkdude Before opening an issue, I have to research it a bit more (but I don't know when) Maybe the class syntax in not really required. Just wanted to know if there was already some discussion about the topic

borkdude15:10:13

first time I've heard it come up, I think most people are using the deftype hack in the blog above, but I'm willing to give it some time, after the talk at ClojureDays (end of this week) :)

jose15:10:14

unfortunately I'm not attending to the conference, but looking forward to see the recording 🙂

❤️ 1