Comment by 616c

12 years ago

I am still trying to get a handle on Lisp and Scheme, but blog posts and projects like this, and the Common Lisp OS posted here previously [0] make me really impressed and confused about why people, if you dislike the Lisp style and philosophy, cannot admire its bizarre powers. I mean, I see most languages from that paradigm (why hate when you can be entertained, either by the good or bad), but this is very cool and way over my head.

[0] https://news.ycombinator.com/item?id=146670

> cannot admire its bizarre powers

Pure jealousy =]. People like to rag on lisp, but their language dujour just got what lisp's been packing for at least 20 years. Between the interactive programming model, compiling to machine code, real threading, macros, and many other features, it's the perfect secret weapon.

  • As much as I find lisp interesting, I've always hated the kind of smug comment like yours that every discussion on Lisp inevitably brings. Lisp is certainly far from perfect, and there are a ton of good technical reasons why people use other languages.

    • Consider it a response to the "lol you use lisp?!? that's really old right??" bullshit you heave to hear whenever you tell someone you use it. Nobody said lisp is perfect for everything. Just that it's better than most people are willing to give it credit for.

      For instance, I'd use C for embedded systems, tight control of memory, or building libraries I wanted to be used everywhere. I'd use Erlang for distributed programming. I'd use Haskel if I needed pure functional programming. I'd use Java if I had a team of 500 engineers working on an enterprise app.

      For any other general-purpose programming, I'd probably pick lisp.

      2 replies →

  • It is my understanding that threading is a sore topic in most common lisps having either poor or experimental support. I'd love to be proved wrong, however.

    • Most Common Lisp implementations have had good threading support for years now, at least on the implementation's primary platforms.

      The threading APIs, however, are all different -- not necessarily in any deep way, but in incidental ways like function names and signatures. There's a package Bordeaux-Threads that provides a portable API layer on top of the various implementation-specific APIs.

  • > People like to rag on lisp, but their language dujour just got what lisp's been packing for at least 20 years.

    Strong static typing? ;o)

    • Well as I have pointed out before, I am still learning but there are few interesting propositions here.

      core.typed - Type Clojure, but still not complete

      Shen - despite its questionable licensing scheme, it is a derivative of Qi. Qi and Shen are very powerful types systems (not just Haskell, but think even more complex like Idris, Coq, Agda, etc). The original implementations, if you want irony, are Common Lisp. The caveat is Shen has been ported to other runtimes, namely, Python and Ruby. But SBCL is the preferred runtime layer for Shen's crazy type system.

      Typed Racket - It is a Scheme, and people will throw things at me, but I think it safe to say static types for this subset prove Lisp family languages have the potential for robust static typing systems you hint at.

      TL;DR: Strong static typing is not common (pun intended), but it is possible. I think what we want to see is Shen with a good license: a very robust type system with a Lisp, separate or library. Then, Lisp will be the one ring-language to rule them all.

      Perhaps we can call this library or Lisp variant Precious, and its hipster vote can go through the charts.

    • Common Lisp already features strong static typing (the example below uses SBCL):

        * (defun foo (x) x)
      
        FOO
        * (declaim (ftype (function (fixnum)) foo))
      
        * (defun bar (y) (declare (string y)) (foo y))
        ; in: DEFUN BAR
        ;     (FOO Y)
        ; 
        ; caught WARNING:
        ;   Derived type of Y is
        ;     (VALUES STRING &OPTIONAL),
        ;   conflicting with its asserted type
        ;     FIXNUM.
        ;   See also:
        ;     The SBCL Manual, Node "Handling of Types"
        ; 
        ; compilation unit finished
        ;   caught 1 WARNING condition
      
        BAR
      

      One could also declare the function signature first (perhaps in skeleton code generated by modelling tools). Then, if someone implements it incorrectly, the compiler will throw an error (again, SBCL):

        * (declaim (ftype (function (fixnum)) qux))
      
        * (defun qux (z) (car z))
        ; in: DEFUN QUX
        ;     (CAR Z)
        ; 
        ; caught WARNING:
        ;   Derived type of Z is
        ;     (VALUES FIXNUM &OPTIONAL),
        ;   conflicting with its asserted type
        ;     LIST.
        ;   See also:
        ;     The SBCL Manual, Node "Handling of Types"
        ; 
        ; compilation unit finished
        ;   caught 1 WARNING condition
      
        QUX
      

      So, what else do you think Common Lisp lacks compare to more "modern" languages? ;)

      2 replies →