3 ms·
I've always found this thing of projects defining Clojure as a dependency of their project to be a artifact of that Clojure wants and aims to be a hosted langua
by diggan 7y ago
I've always found this thing of projects defining Clojure as a dependency of their project to be a artifact of that Clojure wants and aims to be a hosted language. So while it doesn't make much sense to have a Clojure project without Clojure included _somewhere_, it makes plenty of sense (in some specific use cases) to use Clojure as a library in a Java project with Maven, or JavaScript project with ClojureScript compiler as a library.
So with this, are there other languages where they are explicitly designed to be "parasites" like Clojure?
One could argue the many "compiled to JS" language are such, but they are always very hardcoded to JS, so not really parasitic like Clojure.
- jonahbenton 7y agoThe "hosted" part is not quite right. Clojure is hosted, but what I think you are referring to with the "parasite" metaphor is called "embedded." (Distinct use of the term embedded from its use to describe small systems hardware). Clojure was definitely designed to be both embedded and hosted, but those are distinct axes. There are lots of languages designed to be embedded as scripting or automation runtimes in other systems. Tcl, Lua, Python, Guile (a lisp)... Why embedded- pre-web, there used to be a practice of writing your infrastructure in systems language (C/C++) then writing your application tier in a scripting language. Countless games and GUI line of business tools on Windows were written this way. Java in this case was considered a "systems" language, and there is a long history of embedded languages for Java. My favorite JVM-embedded language was called Beanshell. This embedding was/is a use case for Clojure, important for "sneaking" Clojure in to the enterprise. The "designed" part implies that the scripting runtime plays nicely with process-owned resources like threads and memory, and has a well defined interface for exposing your infrastructure objects to the scripting layer. Post-web, if you squint, you can recognize this architecture in the DOM the browser (written in a systems language like C++ or Rust) exposes to its scripting tier (Javascript).
- lwb 7y agoLua, certainly. Lua is basically a C library that just so happens to have a standalone interpreter. It's largely intended to be embedded in other programs, which it does very well considering it is pure C with (basically) no dependencies.