We contemplated giving Julia macros function call syntax, but decided not to. These were a few of the reasons:
1. The @foo syntax serves as a warning to the reader that something unusual is about to happen. Macro invocation isn't at all like a function call and doesn't look like it – it looks like a user-defined keyword, which is basically what it is. 2. If you write map(m,v) where m is a macro, what happens? If you write map(@m,v), there's no expectation that this should do anything but apply the @m macro to zero arguments and then map the result of that over v. 3. We want to discourage excessive use of macros. Macros are the ultimate escape hatch, but using them too much is usually a sign of bad library design or a language deficiency. Having a jarring macro syntax keeps us honest. On Fri, Apr 11, 2014 at 6:16 AM, Mike Innes <[email protected]> wrote: > Lisp has certainly had a strong influence on Julia. First class functions, > homoiconicity, running code at compile time and compiling code at runtime, > the interactive REPL, dynamic typing and GC, everything you could really > want from a Lisp is there. > > But, syntax does make a difference, I think. For example, deeply nesting > expressions concisely is far less natural in Julia than Lisp. Macros, while > just as powerful, are a little more awkward thanks to Julia's more complex > syntax and the fact that you have to often write @foo begin rather than > just (foo. Don't get me wrong, Julia's syntax is great, and it's entirely > the right choice for the technical space, but for that reason I think I'd > say that Julia isn't *a* Lisp as such. Yes, they're similar in terms of > raw language power, but each for different problems. > > I've often thought that a Lisp which compiles to Julia would be a cool > project, though. > > If you're interested, this Paul Graham > essay<http://www.paulgraham.com/icad.html> is > an interesting read. It seems he was spot on about languages with > algol-like syntax adopting more Lisp features. >
