4 ms·
No. I'll explain why: all languages are in some sense equally expressive, because they are Turing-complete. But some languages don't have particular abstractio
by cabalamat 17y ago
No.
I'll explain why: all languages are in some sense equally expressive, because they are Turing-complete. But some languages don't have particular abstractions, for example classes; so in that sense they are not expressive, because you can't express those abstractions.
But Lisp has macros. This means that any abstraction it doesn't yet support, you can add.
- silentbicycle 17y agoNo, because you can't add language invariants (guarantees that thing X will never happen), and without invariants such as pervasive immutability, certain features are impossible to add. While it's possible to add features to Lisp that are at odds with its fundamental model of evaluation, it's usually done by adding an interpreter (or, occasionally, compiler) for a nested sublanguage. There are several interpreters in SICP and EoPL, several Lisp books have a mini Prolog, etc. This is handy (and Lisps do make it relatively easy), but you can't graft something like Erlang's entire semantics onto Lisp with just macros.
- cabalamat 17y ago> No, because you can't add language invariants (guarantees that thing X will never happen) That's true. Macros aren't a perfect solution. > without invariants such as pervasive immutability, certain features are impossible to add. As are certain optimisations. > While it's possible to add features to Lisp that are at odds with its fundamental model of evaluation, it's usually done by adding an interpreter (or, occasionally, compiler) for a nested sublanguage. Indeed, which is in a certain sense cheating. If one is designing a language, and one hopes that one's language will become popular, then it's likely (in fact inevitable) that the language will be used for tasks that the designer hasn't anticipated. So how can a designer cater to this? Macros are one way, and IMO a powerful one. Another is to make the language so that it is easy to mix-and-match it with other languages, so that it can call code in other languages, be called by other languages, use common data structures and serialisation formats, etc. Implementing in the JVM goes some way to meeting this goal.
- ramchip 17y agoMacros aren't always a great solution. I think Haskell is the best example: many features, such as the lazy evaluation, the type system, and especially referential transparency would be very hard to add on Lisp without making it very verbose and ugly. Here's an example: http://marijn.haverbeke.nl/monad.html http://marijn.haverbeke.nl/monad.html