6 ms·
> npm install -g lumo-cljs closh why? seriously, is this the point that modern tooling has gotten to where for no apparent reason it has a node dependency?
by LesZedCB 9y ago
> npm install -g lumo-cljs closh
why? seriously, is this the point that modern tooling has gotten to where for no apparent reason it has a node dependency?
- mbrock 9y agoNode is the runtime for ClojureScript. The whole shell runs in Node.
- LesZedCB 9y agowhat's the tradeoff of clojurescript over native clojure? wouldn't the java clojure runtime be much faster?
- lvh 9y agoSteady-state performance tends to be better on the JVM but startup performance is always much better on top of JavaScript. That makes it an enticing trade off for shells which is a process that you start new ones of constantly and where the performance of the shell itself is often not very important. (Performance-critical or hard-to-duplicate code like, say, line editing code, can be done equally well on either platform via FFI.)
- earenndil 9y agoWhy not just make a server that starts up once in the background and then a lightweight c frontend to the server that essentially just pipes every keystroke to the server?
- cben 9y agoShells are supposed to inherit a ton of state from their parent — [e]uid, groups, working dir, env vars, nice, umask, chroot, ... This takes zero effort in unix, but would all have to be (securely!) re-implemented to be able to send code to a shared execution daemon... And I expect the right implementation for many of these params will be running separate daemons anyway (eg. you clearly want one per user).
- shadowmint 9y agoyes. and multithreaded. Theres no meaningful reason to use cljs other than to avoid java or if the java runtime isn’t available (eg. browser).
- zcam 9y agostartup time: not sure it's good ux to wait seconds for every command... lumo/cljs is instantaneous
- Spivak 9y agoIt's not like you need to spin up a separate JVM for each command.
- shadowmint 9y ago500-600ms is, to be fair, a big one time cost. The downsides are pretty darn significant though. I can’t imagine a situation where I would trade ‘starts a bit faster’ for ‘throw away all parallelism in code’ personally... but hey. Plenty of people use node for very serious stuff. I suppose I just think this is an example of fast and cheap on the fast/cheap/good scale.
- lvh 9y agoBut this is a shell. You start _all the time_, including plenty of times where you don't really notice: other processes often start subprocesses via your shell to get your environment right. Meanwhile, the shell is usually just waiting for you, so it's not like it's an intrinsically parallel process. This doesn't impact the shell's ability to run multiple things at once: the shell eventually creates subprocesses. One would expect an event-loop like Node to be perfect for this sort of thing.
- kloud 9y agoI find to hack on clojurescript on node easier. Also it is easier and starts faster. But many parts of code are platform agnostic. I think it would be cool to eventually port the system specific parts to java apis and have both.
- lvh 9y agoWhat does your development environment look like? Every time I bail on a Cljs project it's because tooling is worse than for Clj.
- emidln 9y agoI use Spacemacs and have the following in inside my .spacemacs in the dotspacemacs/user-config functions: (require 'cider) (setq cider-cljs-lein-repl "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))") Then I just use figwheel to manage my cljs projects (I think this is the default now for reagent and luminus projects, it's also the default for re-natal for react native development in cljs). Life is pretty good and I have a nice debugger via Chrome. I prefer the debugger in CIDER (which doesn't work for cljs) to the debugger in Chrome, but the Chrome debugger is decent (and it's what I'd have in Javascript anyway). There is a nice chrome extension to help with clojurescript eval in the browser/debugger called dirac: https://github.com/binaryage/dirac https://github.com/binaryage/dirac
- s_kilk 9y agoClojure/JVM apps are very slow to start, which makes them particularly unsuitable for a shell, where you typically don't want to wait a few seconds for the prompt to become interactive.
- vbuwivbiu 9y agoi mean, really what is the point of Node ?
- Wintamute 9y agoIt's a highly performant platform, based on a rapidly evolving language that's easy to understand. As such it's largely democratised server/shell programming to millions of users and web developers who could have been turned off by more advanced syntaxes and programming concepts. These people have created millions of open source packages which now dwarf most other communities, and the platform has unlocked an incredible amount of untapped economic value that powers likely hundreds of thousands of businesses around the world. Need I go on?
- vbuwivbiu 9y agoyes, and thankyou for answering. Why use Node over the JVM ?
- Myrmornis 9y agoThat’s answered in the comments elsewhere on this page. Mainly because shell processes are started frequently and the JVM start-up time would be much too slow.
- pjmlp 9y agoJVM starts pretty fast, the problem lies within Clojure's implementation. One can even AOT to native code, if desired.
- Myrmornis 9y agoThe JVM is well-known to start slowly. It's not just clojure. For example, that's why people don't write command-line scripts in scala. I mean this is what I've always read, and is my experience from my limited contact with the JVM, and this is what people who use scala tell me. If you're going to contradict a widely-held belief then you need to provide some justification! Try googling "jvm slow startup".