Live data from Hacker News

REPL vs CLI: IDE wars

vlaaad.github.io

101–110 of 110 posts

Re: REPL vs CLI: IDE wars

#101
post #44

Earlier quoted context omitted.

And I recommend trying out Smalltalk.

As a hobby I want to learn a lisp. Where should I begin? :)

If you want to see how Lisp environments used to be on the hey day of Lisp, check the community editions from Lisp Works and Allegro Common Lisp.

Re: REPL vs CLI: IDE wars

#102
post #4

I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code. In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you'r…

Homoiconicity isn't required for that, all you need is to be able to map between source and AST enough to identify expression boundaries. Plenty of development environments for non-homoiconic languages provide the ability to evaluate a selected expression (not just the last one) in a linked REPL on demand. I love the Lisp family, but I don't know why its advocates often sound like they haven't seen a dev environment…

a comment here some time ago explained nicely what most of these "unique" advantages of homoicinicity are actually about; it was essentially another step on the same spectrum of statement-languages and expression-languages.

in particular this does not mean that it is better but the same advantages of being able to put anything into anything that you find in expression languages like rust in lispy languages are also syntactically in editing source code.

since I started using shrink/grow selection in vscode I have much increased interest for simple syntax aware editing, something simple would be moving blocks of code token by token

Re: REPL vs CLI: IDE wars

#103
post #44

Earlier quoted context omitted.

And I recommend trying out Smalltalk.

As a hobby I want to learn a lisp. Where should I begin? :)

Install sbcl, slime, gnu emacs in some form.

See the book Practical Common Lisp for an intro: https://gigamonkeys.com/book/

Re: REPL vs CLI: IDE wars

#104
post #94
post #83

Earlier quoted context omitted.

> (set -e; echo hi); echo $? It works in my shell. :-/ It looks like you forgot to insert `false` command. You are pointing to the problem with -e not working in subshell/deep functions, because of POSIX. Right? It's described in bash documentation: http://www.gnu.org/software/bash/manual/html_node/The-Set-Bu... > I think just defining a die() function and using it after any command that must succeed is more verbose,…

If you're using ZSH, this will give you a Python-style backtrace showing the specific line of each failure, even with nested function calls. https://gist.github.com/zachriggle/8574964d2e3078cdfae84b574... e.g. An error occurred on ./test:18 Frame 1 (./test:21) 18 false 19 } 20 21 >>> a Frame 2 (./test:6) 3 source TRAPERR.zsh 4 5 a() { 6 >>> b 7 } 8 9 b() { Frame 3 (./test:10) 7 } 8 9 b() { 10 >>> c 11 } 12 13 c() { F…

I can do this in bash too (partially), with `set -eE` and bash-modules:

  #!/bin/bash
  . import.sh strict log
  a() {
    b
  }
  b() {
    c
  }
  c() {
    d
  }
  d() {
    false
  }
  
  a
Result:

  $ ./test.sh
  [test.sh] PANIC: Uncaught error.
  at d(./test.sh:13)
  at c(./test.sh:10)
  at b(./test.sh:7)
  at a(./test.sh:4)
  at main(./test.sh:16)
However, it stops to work at some point, e.g. in `for` loop, or in a subshell. zsh is better in this regard.

Re: REPL vs CLI: IDE wars

#105
post #91
post #45

Earlier quoted context omitted.

Now try to fix the code from the unit test when it breaks and redo the unit test, from the point where it broke.

So that you can run your unit test from some unknown state that may not even be reachable from the current text of the code, rather than running it from the start in a reproducible way? Why would that be something you want?

Unit testing was born in the Smalltalk community, good tooling is orthogonal to having tests.

Re: REPL vs CLI: IDE wars

#106
post #57
post #14

Thanks for introducing me to `add-lib` This is going to be a huge time saver :) More info here: https://insideclojure.org/2018/05/04/add-lib/ Hopefully there will be some way to just "reload" your whole `deps.edn` though "If you get an error, the execution stops by default and you get a stack trace." I'd say the other missing piece of REPL development is that while you get a stack trace, you don't get a program state…

CIDER ships with a perfectly adequate debugger if you want it. Might require a bit more manual labour than some environments but you’re never stuck just staring at a stack trace if that’s what’s bothering you. I think using external dev dependencies and rich dev/user.clj files is pretty common on Clojure projects. Your REPL isn’t just somewhere to interact with the current codebase directly, it’s a framework for buil…

I need to play with the debugger again.. Does it give you the state along with a crash stack? I remember that unfortunately the debugger couldn't be turned on globally. You need to instrument particular functions. And this turned out to be a major inconvenience in my usecase (a GUI app)

But I'll take another look in my next project

Re: REPL vs CLI: IDE wars

#107
post #86

Earlier quoted context omitted.

Clojure's sweet spot is very much the "situated program" Hickey likes to talk about. Clojure is a great fit for line of business apps where maps really are the right choice for modeling your domain. We recently evaluated Clojure vs node for an upcoming project and went with Clojure because while most of the work really is just querying a db and writing JSON, we also do a fair amount of heavy reporting and pdf generat…

It comes down to the JVM vs nodejs and which is better for your project. The JS ecosystem is way richer than clojure's though. Can you share your approach to generating PDFs in Clojure?

As far as ecosystem, Clojure itself is smaller, but the whole JVM ecosystem is huge and you have access to that.

We're not at a point where we've figured out how we're doing report generation yet. Internally we do not have extensive experience with either Clojure or Node, but we have heard issues from colleagues with Node and running into performance issues by trying to do too much on the main thread. Since our load demands are not that high, and we're migrating from Rails so we already expect a very nice performance bump, rejection of Node is more a choice of avoiding potential downfalls rather than a fully informed decision based on experience with Node.

Re: REPL vs CLI: IDE wars

#108
post #106
post #57

Earlier quoted context omitted.

CIDER ships with a perfectly adequate debugger if you want it. Might require a bit more manual labour than some environments but you’re never stuck just staring at a stack trace if that’s what’s bothering you. I think using external dev dependencies and rich dev/user.clj files is pretty common on Clojure projects. Your REPL isn’t just somewhere to interact with the current codebase directly, it’s a framework for buil…

I need to play with the debugger again.. Does it give you the state along with a crash stack? I remember that unfortunately the debugger couldn't be turned on globally. You need to instrument particular functions. And this turned out to be a major inconvenience in my usecase (a GUI app) But I'll take another look in my next project

Yeah you’re right, that’s what I mean by manual labour, there’s no ability last I checked to break on any exceptions. But in any case of a reproducible issue you’re not stuck, is all I mean.

Re: REPL vs CLI: IDE wars

#109

Earlier quoted context omitted.

Does it? Asking for a value when encountering an unbound variable is a default restart $ sbcl This is SBCL 2.1.1.52.HEAD.321-f8a57bcca, an implementation of ANSI Common Lisp. More information about SBCL is available at . SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the di…

Yeah, in fact, Clojure needs special tooling for this, while it’s built into CL’s execution model.

This is interesting tool[1] that allows much the same with Clojure

[1]: https://github.com/IGJoshua/farolero

Re: REPL vs CLI: IDE wars

#110

Earlier quoted context omitted.

Homoiconicity isn't required for that, all you need is to be able to map between source and AST enough to identify expression boundaries. Plenty of development environments for non-homoiconic languages provide the ability to evaluate a selected expression (not just the last one) in a linked REPL on demand. I love the Lisp family, but I don't know why its advocates often sound like they haven't seen a dev environment…

Homoiconicity is an ill-defined concept. If you take every subjective feature from it, all it implies is that you are able to cut your code into well defined AST structures (what all languages have, but for some it's easier than for others). So, yeah, anything people do with Lisp could be done for any other language, it only requires more complex tooling. How much more complexity depending on the language, and it var…

To me, "only" and "complex" shouldn't be used in the same sentence. Big part of the job of a developer is to reduce complexity, and we barely do it (depending of the system). What is "barely perceptible" now can be "completely not practical" 2 years down the road.
Post reply on HN