5 ms·
I'd say Julia's macros are basically at a lisp level. The main difference between Julia and lisp macros is that julia has more syntactic forms so macro writing
by eigenspace 7y ago
I'd say Julia's macros are basically at a lisp level. The main difference between Julia and lisp macros is that julia has more syntactic forms so macro writing has some extra cognitive overhead.
- didibus 7y agoHaven't looked at them in a while, but already that difference there is my second listed point above. So it's no small difference. I'd also like to flip the question around: Why do these other languages bother with complicated syntaxes and then try and spend so much energy in trying to close the gap with Lisp Macros? Why don't they just go with a Lisp syntax from the get go? I know the answer is they want non Lispers to use their language :p But seriously that's frustrating to a Lisper like me. Julia would be beautiful if it had a Lisp syntax.
- snicker7 7y ago> Julia would be beautiful if it had a Lisp syntax. It don't think it would. Lisp achieves its homoiconicity by using the same structure for data and code: the (possibly nested) list. This allows data and code to be manipulated in similar ways. Julia, unlike Lisp or APL, doesn't prescribe a preferred data structure (and shouldn't, considering its emphasis on performance).
- didibus 7y agoI'm not sure I understand the issue your are pointing out? Julia calls itself homoiconic, it uses Expr to model its AST and the parser returns it. There's even a show_expr method that prints it as an S-expression. It just goes through great lengths to somehow have a textual representation that isn't s-expression based and then parse/print back and forth between the two. Julia also has plenty of prescribed preferred data-structure, it has a standard Array with a Vector literal [1,2,3] which is heterogeneous and it has a standard Dict type as well. So I'm seeing nothing that would be problematic if it had just gone with a Lisp syntax.
- flavio81 7y ago> There's even a show_expr method that prints it as an S-expression. Yes. However, the 99.9999% of Julia code out there isn't in s-expressions. Every Julia programmer doesn't use s-expressions. They use Julia syntax. Thus, the task of writing Macros in Julia is harder than doing the same thing in Lisp. >So I'm seeing nothing that would be problematic if it had just gone with a Lisp syntax. They should've gone with a Lisp syntax, IMO. Beginners, who haven't passed through the chore of learning C-like syntax, find s-expressions as easy as any other kind of syntax.
- didibus 7y agoI'm with you, I just thought prior commenter was making a claim that Julia couldn't have been designed with a Lisp syntax, so I thought pointing out that it can already support representing all of its code as an s-expression kind of shows it could have very well had a Lisp syntax. I wonder if it's too late :p, maybe it can do what Racket does, and build on some per file #lang macro, give us proper Lisp syntax.
- kazinator 7y agoComment betrays adherence to the incorrect assumption that Lisp code is always made of nested lists, which are traversed to bring about slow interpretation.
- deleted 7y ago[deleted]