Hacker News new | past | comments | ask | show | jobs | submit login

> Many (probably most?) of them don't, but I don't know that it has much to do with the syntax.

It has to do with the syntax. Working Lisp "plugins" is very simple because all the code is represented as plain datastructures. Rewriting program is like writing simple data structures manipulation code.




The same is true for any AST. The datastructures get marginally more complicated, but that's rarely the limiting factor.

Strictly speaking, AST data structures are often full of junk, but that's not mostly a matter of the complexity of the syntax itself but of the variety of things being done with that AST - you can't report error locations if all you have is the nested lists representing your Lisp program.

The focus on making macros work well is absolutely a strength of Lisps. The syntax is a much smaller part of that than the lore would suggest.


I agree with you generally it is possible with other langauges but to really do it is quite hard. As of right now I will stick with Clojure compared to the alternatives. I also really like working in rust and I have found use for macros there too.

More syntax makes things harder, compiler that have not been designed wit this goal make things harder. You can look at the papers trying to get this stuff in to other langauges and there are some problems, dylan [1] was doing it befor most others, now rust is coping that stuff.

Actually some of the coolest stuff was done by David Moon (Common Lisp, Dylan) he greated a langauge spec that he calls PLOT [2] and it has a very inovate macro system. For anybody that is intrested in that sort of stuff I highly recommand it.

[1] http://people.csail.mit.edu/jrb/Projects/dexprs.pdf [2] http://users.rcn.com/david-moon/PLOT/ and http://users.rcn.com/david-moon/PLOT/Moon-ILC09.pdf


More syntax makes things harder, but the amount of hardness introduced by the craziest syntax is dwarfed by the rest of hardness involved in introducing a type system. It's like saying "Steve was able to walk 20 miles, because his driveway slopes down a little". It may be true that his driveway slopes down, and that may make that stretch easier, but other things are more important.


Its no different in any other language with macros, the data structures are just bigger. It's pretty easy to write a Rust macro or Scala macro that consists of simple data structure manipulation. I have a simple example here: https://github.com/jroesch/pg-typeprovider/blob/master/src/t....




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: