4 ms·
Well clojure having a lisp syntax allows an optional type system to be build as a library. https://github.com/clojure/core.typed https://github.com/clojure/cor
by nbardy 12y ago
Well clojure having a lisp syntax allows an optional type system to be build as a library.
https://github.com/clojure/core.typed https://github.com/clojure/core.typed
- dllthomas 12y agoCould you explain how that would have been prevented by another syntax?
- nickik 12y agoWell, it would just require the person building the type-system to write a parser himself and it would need to be a extra step in your compilation pipeline. It would be like a linter.
- dllthomas 12y ago"it would just require the person building the type-system to write a parser himself" Or use an existing, language provided parser - haskell-src-exts, for instance. "it would need to be a extra step in your compilation pipeline" I don't see what that has to do with syntax. Any compiler could have a hook where it hands off a parsed AST - many do.
- nickik 12y agoSure any compiler, could but 99% of them dont. I have jet to see compiler hooks that are as simple as to write as they are in lisp. Also, most of them are far less powerful then they are in clojure. I see tons and tons of example were people use clojure macros in intressting ways but not that many people who write scala compiler hooks. So in theroy you are right, in practice I have not jet seen tons of examples.
- dllthomas 12y agoMany (probably most?) of them don't, but I don't know that it has much to do with the syntax. And many do. GCC has a plugin infrastructure, and Clang is well known for having a better one. Clojure has a lot of great things going for it. I don't have any objection to Lisp syntax - I like it although I don't know that I prefer it - but I don't think we should be crediting it with things more properly deserved by other pieces. Proper support for macros is a biggie.
- mateuszf 12y ago> 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.
- dllthomas 12y agoThe 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.
- nickik 12y agoI 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 http://people.csail.mit.edu/jrb/Projects/dexprs.pdf [2] http://users.rcn.com/david-moon/PLOT/ http://users.rcn.com/david-moon/PLOT/ and http://users.rcn.com/david-moon/PLOT/Moon-ILC09.pdf http://users.rcn.com/david-moon/PLOT/Moon-ILC09.pdf