7 ms·
I'm waiting for the day somebody with write a Clojure transpiler for a non-Lispy syntax! Although I love Lisp (I used to use it 20+ years ago daily), but the ye
by nikolay 10y ago
I'm waiting for the day somebody with write a Clojure transpiler for a non-Lispy syntax! Although I love Lisp (I used to use it 20+ years ago daily), but the year is 2016!
- ambulancechaser 10y agoHow could you implement macros in any sane way without s-exps? You need an AST and the hoops involved if you didn't have something like lisp would be terrible. Imagine running a macro over python or C code.
- ebiester 10y agoElixir has an interesting way of approaching the problem. http://elixir-lang.org/getting-started/meta/macros.html http://elixir-lang.org/getting-started/meta/macros.html
- Gonzih 10y agoBut this introduces additional ast format. Something in between simplicity of the syntax and complexity of the real ast. In lisp like languages you are working with syntactic forms from the language. Seems like extra overhead without any gain.
- ebiester 10y agoI would personally rather optimize for the convenience of reading the language than writing the macro, but I understand the tradeoff. (And though I came to S-exprs early in my learning, algol-style still is easier for me to parse and read.)
- fnordsensei 10y agoAnd this is precisely the point of divergence, as "readable" understandably means different things to different people. Personally I find Clojure very readable, but of course I don't mean that in some kind of objective sense of the word.
- kimi 10y agoComing from a Clojure background, "extra overhead without any gain" is more or less the definition of Elixir.
- fnordsensei 10y agoIsn't the Erlang VM and ecosystem sort of the selling point of Elixir? Not that I'm particularly well versed in the specific strengths and weaknesses of that platform.
- LeonidasXIV 10y agoYes, but you can have that with Erlang as well and I think this is exactly what grandparent was alluding to.
- hackerboos 10y agoRuntime overhead possibly. Developer productivity is likely increased. Hard to measure that though.
- konradb 10y agoWhat syntax do you feel would be more expressive and as versatile, while not losing macros?
- nikolay 10y agoWell, Rust has macros [0], too! [0]: https://doc.rust-lang.org/book/macros.html https://doc.rust-lang.org/book/macros.html
- nickik 10y agoRust has tons of problems with macros and they are still not fully in the language (last I checked). Rust macros actually do go back to Lisp. Specifically the Dylan language, a Lisp once envisioned as the equivalent of modern Objective C by Apple. Their are a number of papers from that period that you can read. Macro systems are not all the same, they don't all have the same power. Clojure uses a very powerful form that is not as safe. Their is a lot of modern research in Racket. A extremely powerful macro in a language with syntax was specified but never implemented by David Moon, you can find it here: http://users.rcn.com/david-moon/PLOT/ http://users.rcn.com/david-moon/PLOT/
- steveklabnik 10y ago"Macros" can be an overloaded term in Rust. Specifically, "macros" mean "macro_rules!", which is very much in the language. Compiler extensions, which are sometimes called "procedural macros", are still unstable.
- bad_user 10y agoNot sure what the year has to do with anything, but most things in computer science were invented in the sixties and the seventies or even earlier and since then we've only been refining them. In terms of programming languages, the theoretical breakthroughs have been in terms of static typing, even though note that even the Hindley-Milner type system has been first described in 1969. In other words, strange thing to complain about a syntax that has stood the test of time. After all, most mainstream languages (C, C++, Simula, Pascal, Java, etc) are Algol-based, a language that first appeared in 1958. And no, you can't have LISP without its syntax, because that's what's giving it power. The "code is data" mantra only works because Lisp is homoiconic, because it basically has no meaningful syntax other than syntax for describing its primitive data-structures, which makes its macros first class and its "eval" natural. But in the LISP family Clojure is actually quite modern. It runs on both the JVM and Javascript engines. It does have extra syntax for describing sets and maps. Its data-structures are immutable and it encourages immutability to a far larger degree than other LISPs. But it also has very good interoperability with the underlying platform.
- nikolay 10y agoBy the way, it's now "Lisp", not "LISP". I love the original Lisp, because it was simple Syntax was so suitable for AI and treating code as data, but Clojure is not as simple syntax as Lisp! So, it's both complicated and unusual to the nowaday developer!
- deleted 10y ago[deleted]
- xearl 10y ago> And no, you can't have LISP without its syntax, because that's what's giving it power. The "code is data" mantra only works because Lisp is homoiconic No. Homoiconicity is nice for "code is data" and macros, bot not necessary. Being able to reify and generate ASTs is sufficient. See for example Dylan, Terra/Lua, Scala LMS, MetaML, or Julia's or Rust's macros.
- 10y ago
- ungzd 10y agoUsually people do the opposite — write transpiler from lispy syntax to some language's syntax. For example: lfe, hy, to some extent clojurescript.
- willismichael 10y agoFor those who find all of those parenthesis off-putting: http://clochure.org/ http://clochure.org/
- mannykannot 10y agoI suspect that if you think parentheses are the problem, they are not the problem.
- nikolay 10y agoYeah, I actually love the parentheses!