Re:Owl Lisp – A purely functional Scheme that compiles to C
by lbenes on Saturday September 10, 2016 @02:38PM
(#12470381)
C++ has many pure functional features that C lacks. For example immutable methods with const and Lambdas. Wouldn't these features make it easier target to C++ rather than C? Do these functional features only make it easier for a human to write functional code or is there some other reason these Lisps all use C?
[ Parent
| on HN ]
Re:Owl Lisp – A purely functional Scheme that compiles to C
by wyager on Saturday September 10, 2016 @04:18PM
(#12470716)
If you're writing a compiler, you're going to want to explicitly manage closures and function pointers anyway.
Re:Owl Lisp – A purely functional Scheme that compiles to C
by qwertyuiop924 on Saturday September 10, 2016 @04:06PM
(#12470677)
If you're passing around your environments in the C code (which you should be doing anyways), than there is no reason it would be easier to target C++.
Re:Owl Lisp – A purely functional Scheme that compiles to C
by palunon on Saturday September 10, 2016 @03:04PM
(#12470471)
Lambdas are actually just a nice way to write functions/function objects without polluting the scope.
I guess a compiler have no such problems.
Immutable methods are the same thing as a safety check for humans. As you want to check for these things anyway (since you probably don't want errors to come from the c++ compiler), they don't add value.
(AFAIK, they may trigger optimizations, but so does passing const parameters to a free function, which is the C equivalent)