Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could write safe-ish C++ and Rust that is both readable and fast.

Could you point me to some benchmarks of Lisp being comparable to C?

Also, unless I am mistaken, Common Lisp doesn't have strong types. How can you make either fast or safe language without compiler knowing the types?



Others have responded, but without much depth. Common Lisp on SBCL (maybe the proprietary compilers are similar/better, I haven't worked with them) has a remarkably good type inference system. You need to declare, which is optional, but of course you'd need to declare all your types anyway in Rust or C++. The result is extremely good- for a highly dynamic language. Real number crunchy code actually gets very close to bare metal performance with type declarations, though if you're doing generic function calls it'll choke up fast.

So to get fast, the compiler knows the types because you tell it. For safe, you don't need to do anything- CL is garbage collected. It's easy to have fast or safe in any language- doing both requires type declarations and a good optimizing compiler.

That being said, none of that matters for this discussion. Nyxt uses Webkit under the hood because CL, even with SBCL pulling off genuine miracles, is not really intended to go toe to toe with C. I think of CL as occupying around the same niche as Java, which it's usually only a bit slower than.


SBCL (the implementation) gives us pretty useful type errors and warnings. It is not "fully typed" (see Coalton for a Haskell-in-Lisp) but very useful anyways: it warns on a function arguments not having the right types, stuff like this. The nice part is that we get these warnings instantly, since we compile the code function by function. We can add type declarations, that help the compiler further infer types, throw more warnings, and optimize code.


Your point stands, but I think you're arguing about static vs dynamic typing, rather than strong vs weak typing.

CL is dynamically typed (values have types, not variables), w/ strong types (automatic type coercions are rare).


You are mistaken, CL is strongly typed.


Strongly, but not statically typed.


Wikipedia says that it is optionally typed. Is it not so?


I don't see "optionally typed" anywhere in here: https://en.wikipedia.org/wiki/Common_Lisp

I do see "Typing Discipline: Dynamic, strong"





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

Search: