other-languages

mauricio.szabo 2024-05-02T16:40:30.604339Z

Is it too controversial to say I'm liking the REPL-Driven with Ruby so much, that it might be even better than with Clojure? think_beret

2024-05-02T16:41:47.740359Z

what feels better about it?

Yehonathan Sharvit 2024-05-02T17:16:17.836089Z

Details please

mauricio.szabo 2024-05-02T17:55:00.895939Z

Ok, so - because Ruby is not "flat" like Clojure, I need to "trace" execution so I can keep local bindings. Ruby have this binding object that's basically an opaque "thing" containing local vars, self, and all context around that specific part of the code - meaning that I don't need to do something like (defn handle-root [req] (def r req) ...) to bind req to something so I can inspect - the binding already does that for me.

mauricio.szabo 2024-05-02T17:55:22.671599Z

Because I have this "trace" thing, it also brings me visibility - when something happens, the Ruby interpreter calls back to the plug-in saying "hey, I called a method in this file and line" so I know exactly where to look when I do some interaction in the app

mauricio.szabo 2024-05-02T17:56:54.552529Z

Also Ruby is more "dynamic", meaning that if I eval something, it "patches" the class so I don't need to stop servers and start them again to see the results (well, at least in theory - because Ruby without Rails is a myth, Rails hot-reloads things anyway so I don't have to worry about it). And also, bindings work on template things - meaning that I have inline evaluation on HTML templates too

😍 1
2024-05-02T18:25:41.594229Z

Make sense, but it looks like you have a debugger open no? Not a repl? Debuggers can instrument the code and all to do more things. It be cool to have something like that in Clojure, it's just annoying because it involves more the runtime, and that's just JVM.

2024-05-02T18:26:31.979589Z

But ya, Clojure REPL suffers a lot from being a non-interpreted language and running on the JVM. The flip side is Clojure is more performant than Ruby

mauricio.szabo 2024-05-02T18:46:44.550349Z

@didibus it's actually a nREPL implementation: https://gitlab.com/clj-editors/nrepl-lazuli

mauricio.szabo 2024-05-02T18:52:39.689769Z

There's no debugger involved, actually. Tracing is something that the Ruby interpreter supports (even on JRuby) and binding is also a Ruby public API thing. I don't "pause" execution of any code, and in fact, I can have multiple "watch points" defined at any time, each representing some old evaluation that called that specific method.

2024-05-02T18:54:14.248039Z

nRepl doesn't support watch points, breakpoints and all that no?

2024-05-02T18:54:57.626229Z

Also, all the tracing you describe no?

2024-05-02T18:56:44.301599Z

I guess my point is, the tracing and watch points and breakpoints would additional debugger features on top of the repl

2024-05-02T18:57:23.604439Z

Features I think it be nice if Clojure did more of that as well. The cider debugger is pretty neat, but it's not getting a lot of improvements.

mauricio.szabo 2024-05-02T18:58:52.534609Z

Tracing is this one: https://ruby-doc.org/3.2.2/TracePoint.html#method-c-trace nREPL doesn't - I extended it a little bit to do the same as :out and :err does - but instead of calling back the plug-in with the result of STDOUT and STDERR, it calls back with the "trace" info. For watch points, I defined a new op that gets the watch points for the current file; then I pass which watch point I want to use as an additional parameter for eval op

mauricio.szabo 2024-05-02T19:00:18.883549Z

Meaning: I could re-use 90% of Chlorine's code, I just had to write a nREPL implementation and add some new operations 😍

2024-05-02T19:07:56.227989Z

That's neat. I guess I'm just pointing out that those are debugger features added on top of nRepl. And I feel in Clojure, people almost get lazy, thinking you can just tap/println to debug. And they forget how amazing debuggers are. I use the basic cider debugger and tracer all the time, and it's amazing, albeit a little bare bones. So I would like people to acknowledge how awesome debuggers are and maybe we get more investment in them. One big challenge with them is the Java bits though. Nothing new here, all the quirks are from Java haha. Too bad we need it's libraries and amazing VM otherwise we'd have paradise.

2024-05-02T19:09:05.644359Z

I haven't tried flow storm yet. But it looks really good though

πŸ’― 1
mauricio.szabo 2024-05-02T19:20:05.970459Z

After my experience with this experiment in Ruby, I have some ideas to FlowStorm - maybe we can hack something together soon-ish (we live really close by 🀣 πŸ‡ΊπŸ‡Ύ)

mauricio.szabo 2024-05-02T19:41:42.747959Z

> the tracing and watch points and breakpoints would additional debugger features on top of the repl Yeah, now I get it. I agree, for example, I use a lot the Chrome Devtools while working with pure Javascript, and it's AMAZING to use actually; to the point I was studying a way to integrate it in my ClojureScript workflow (not that easy, unfortunately). I honestly think we can do better with the tools we have. I remember once hearing about WhyLine (https://www.youtube.com/watch?v=3L4MK2dG_6k), and asking myself why don't we have something for Clojure. With FlowStorm, maybe we can?

πŸ‘ 1
tengstrand 2024-06-01T04:43:41.075579Z

WhyLine looks pretty cool!