clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
vnctaing 2020-12-23T00:30:12.452600Z

Is it me or Rails community is about to have something close to Clojure’s REPL experience ? https://hotwire.dev/

valerauko 2020-12-23T11:01:17.455300Z

phoenix was inspired by rails, and now the circle closes with rails being inspired by phoenix

clyfe 2020-12-23T11:48:06.456800Z

Ruby's REPL is called IRB https://en.wikipedia.org/wiki/Interactive_Ruby_Shell

1
clyfe 2020-12-23T11:51:35.457200Z

That hotwire thing can work with things like compojure too!

polymeris 2020-12-25T20:10:08.470200Z

That might be interesting to play around with... but I can't find something like a spec on how the backend should respond to turbo queries (or how websockets should work).

polymeris 2020-12-25T20:11:02.470400Z

From a very cursory glance it also all seems a little too magical

polymeris 2020-12-25T20:11:07.470600Z

Cool, though

clyfe 2020-12-26T07:43:48.471600Z

Frames add events to links and forms such that they actionate via ajax instead standard, and the response replaces the frame as per directives. For how streams action, see https://github.com/hotwired/turbo-rails/blob/main/app/javascript/turbo/cable_stream_source_element.js

tvaughan 2020-12-29T11:00:54.000400Z

See also https://github.com/defunkt/jquery-pjax

vnctaing 2020-12-23T00:30:49.452800Z

Go to intro video 8:10, where he shows a Rails console, interacting with the browser UI

holymackerels 2020-12-23T01:20:59.453400Z

it reminds me of elixir too, the cli interaction and also hotwire is just like phoenix liveview it seems

👍 1
AJ Jaro 2020-12-23T12:46:48.458500Z

Does anyone use the --module-bind argument of webpack? I was looking through the https://webpack.js.org/concepts/loaders/#cli and it seems like this flag doesn’t work Is there another way to incorporate modules from the CLI?

clyfe 2020-12-23T15:58:46.459200Z

(defn f [] 1)
=> #'cljs.user/f
(= f (with-meta f {:a 1}))
=> false
Is this a bug?

dpsutton 2020-12-23T16:05:03.459900Z

looks like MetaFn needs to implement IEquiv?

bronsa 2020-12-23T16:09:30.460400Z

it's not a bug

bronsa 2020-12-23T16:09:36.460700Z

= on functions compares for identity

clyfe 2020-12-23T16:10:05.461100Z

"metadata does not impact equality" https://clojure.org/reference/metadata

bronsa 2020-12-23T16:10:07.461200Z

it's the same in clojure

bronsa 2020-12-23T16:10:15.461500Z

functions are not compared via equality, but via identity

bronsa 2020-12-23T16:10:22.461700Z

they don't have equality semantics

dpsutton 2020-12-23T16:26:12.462400Z

thanks @bronsa. I get a bit confused about when things are vars versus when things are the contents of the var

littleli 2020-12-23T17:21:59.464700Z

I'm almost afraid to ask this but what's the way to work with custom-elements in clojurescript? Usually in Javascript you create a new class extending HTMLElement. I'm not aware Clojurescript supports classes and inheritance in Javascript tradition. Can anyone suggests where to look?

p-himik 2020-12-23T17:27:22.464800Z

In CLJS, you will have to create a new object and directly change its prototype: https://stackoverflow.com/a/61040931/564509

p-himik 2020-12-23T17:27:56.465100Z

BTW the comments mention HTMLElement. :)

littleli 2020-12-23T17:54:01.465300Z

it basically says I'm doomed 🙂

thheller 2020-12-23T21:01:30.466300Z

if you use shadow-cljs you can do class ... extends using shadow.cljs.modern/defclass

thheller 2020-12-23T21:02:40.466800Z

only with (extends js/HTMLElement) same position as (field ...)

👍 2
littleli 2020-12-23T22:46:41.467300Z

Wow! Thanks @thheller for sharing!