Live data from Hacker News

Common Lisp homepage

lisp-lang.org

151–160 of 313 posts

Re: Common Lisp homepage

#151
post #137

Earlier quoted context omitted.

Thanks. Seems my assessment and SBCL's self-description match perfectly, as they explicitly aim to "reward the use of type declarations throughout development" and exhort users to "always declare the types of function arguments and structure slots as precisely as possible" . They do want their users to use one of Common Lisp's least safe features pervasively. If the point was to mine assertions for type information,…

> They do want their users to use one of Common Lisp's least safe features pervasively It's not an unsafe Common Lisp feature. The standard does say nothing about its unsafeness. Only implementations may be unsafe. The Common Lisp standard says nothing how the implementation deal with type declarations. There is a wide range of behavior in Common Lisp implementations dealing with type declarations. Some will do nothi…

You skipped the important part:

> If the point was to mine assertions for type information, they could have encouraged the use of assertions.

With that in mind:

> Some will add more runtime checks when types are declare. Thus the code is MORE safe at runtime.

Users can portably and safely use assertions if they want that behavior. Encouraging the use of declarations instead is neither portable nor safe since, as you said:

> Some compilers may add less runtime checks and will create specialized code -> less safe.

Re: Common Lisp homepage

#153
post #60
post #58

Earlier quoted context omitted.

However: if not []: print("looks boolean to me...")

Can't win em all I suppose :P My point is that, for me, Common Lisp is particularly defficient in this regard, in a way that means I can't really consider using Common Lisp for development work today.

Different programming languages play different games with booleans, empties, undefinedness and such. In all of them, people are able to Get Stuff Done, correctly handling inputs from the world.

In the POSIX shell, a failed termination status of a command is a false condition. Storing false as a datum is usually represented by an empty or unset variable.

Yet, people are able to write robust shell scripts to boot systems, build programs and so on.

Everything you wrote is based on a guess; not even anecdotal experience. That is below the expected level of discussion on HN.

The nil/empty/false thing is an excellent tradeoff in code that manipulates lists, rendering it succinct. For instance an expression like (when attributes (do-this ...)) means, (do-this ...) when attributes are present; i.e. the list of attributes is not empty. All the default nil return values that occur are automatically empty lists, which is very convenient. For instance a two-clause if (if condition then) returns nil if condition is false. If the caller expects a list, then that is perfect; it's the empty list. All these little conveniences dove-tail together to clarify the code.

The empty/false conflation doesn't do anything in code that doesn't manipulate lists. For instance, if you're manipulating numbers, or strings, there is no ambiguity: nil isn't a number and it isn't a string. It is distinct from 0, 0.0, and "".

You cannot have a meaningful opinion about this that anyone should take seriously unless you have experience with it: having experienced both the convenience in writing list manipulation code (particularly code-writing code) and the situations in which the ambiguity between nil (the atom) and nil (the empty list) was actually a problem.

Re: Common Lisp homepage

#154
post #133

Earlier quoted context omitted.

Type declarations in Common Lisp are unsafe. Violating a declaration at runtime is UB. What SBCL is doing to Common Lisp is similar to what C compiler vendors did to C. In order to win at benchmarks, C compiler vendors started to use UB as a license to miscompile optimized code, which got them better benchmarks. Common Lisp has very little UB, so the C strategy is harder to execute. SBCL basically first needs to suck…

> poisoning the ecosystem Please don't take HN threads into programming language flamewar; we've all seen what this leads to elsewhere. It's both possible and much preferable to simply make your points flame-free. https://news.ycombinator.com/newsguidelines.html

You are right, I misjudged the inflammatory power of my choice of phrasing.

Re: Common Lisp homepage

#156
post #84
post #81

Earlier quoted context omitted.

> how I don't have to worry about it fading like the next programming fad. I'm not sure I understand this bit. What other programming language has "faded" and how has it "faded"? At least since the more mature age of software, which I'd say started around '95 or so (so 20+ years).

Pascal, perl, ASP, every ML, Fortran, Cobol, Eiffel, Modula, all "4GL" languages.

Fortran is still going strong with Fortran 2008. And even better, it’s backwards compatible still with Fortran 77.

Re: Common Lisp homepage

#157

This is a very nice web site describing a programming language with unparalleled expressiveness, power and permanence. I am heavily invested in Common Lisp. We are developing a programming environment for designing new materials and molecules called Cando ( https://github.com/drmeister/cando ) using Common Lisp as a scripting language. Cando is running on Clasp ( https://github.com/clasp-developers/clasp ), a new Com…

Since you're already using LLVM, I'm wondering if you've thought about adding something similar to the includec function in Terra [1] which uses Clang to parse C headers. I used to think that Lisp's CFFI was the best FFI out there until I saw that it was possible to literally parse a C header file and have it "just work". It seems like if you're already building against LLVM, so bundling Clang with your project too m…

Thank you - I'll check it out.

We exposed the AST and ASTMatcher libraries of Clang inside of Clasp and we use it to analyze all of the Clasp C++ code to build an interface to the Memory Pool System memory manager.

I want to have something that can include C and C++ header files and automatically expose them to the Common Lisp - that would be neat! Maybe we can steal some ideas like the includec function of Terra.

Re: Common Lisp homepage

#158
post #137

Earlier quoted context omitted.

> They do want their users to use one of Common Lisp's least safe features pervasively It's not an unsafe Common Lisp feature. The standard does say nothing about its unsafeness. Only implementations may be unsafe. The Common Lisp standard says nothing how the implementation deal with type declarations. There is a wide range of behavior in Common Lisp implementations dealing with type declarations. Some will do nothi…

You skipped the important part: > If the point was to mine assertions for type information, they could have encouraged the use of assertions. With that in mind: > Some will add more runtime checks when types are declare. Thus the code is MORE safe at runtime. Users can portably and safely use assertions if they want that behavior. Encouraging the use of declarations instead is neither portable nor safe since, as you…

There are several misconceptions about how people use Common Lisp.

> Users can portably and safely use assertions if they want that behavior

The point is that SBCL can check both at compile-time and at runtime. Which the others (exception: CMUCL and Scieneer CL) can't.

    * (defun foo (a) (declare (string a)) (+ a 10))
    ; in: DEFUN FOO
    ;     (+ A 10)
    ; 
    ; caught WARNING:
    ;   Derived type of A is
    ;     (VALUES STRING &OPTIONAL),
    ;   conflicting with its asserted type
    ;     NUMBER.
    ;   See also:
    ;     The SBCL Manual, Node "Handling of Types"
    ; 
    ; compilation unit finished
    ;   caught 1 WARNING condition

    FOO
That means SBCL tells me already at compile-time that there is a problem in my code. That's something which a development environment can exploit. I get a list of compiler warnings and can then fix my code - without the need to run it and to go into a break - and without the need to have a test case.

Now if I fix that error and run that code in my other implementation - that problem is also fixed there.

Now you assume that adding an assertion would have had a benefit for the other implementation, since it would then create a runtime assertion violation if not a string is provided.

The thing is: this is usually not done. Nobody writes code with assertions everywhere in Common Lisp.

What Lisp a developer really does: if we need to provide a runtime check, then we write a CLOS method.

Thus by default we encourage developers to use CLOS:

    CL-USER 23 > (defmethod foo ((s string))
                    (concatenate 'string s "bar")) 
    #

    CL-USER 24 > (foo 3)

    Error: No applicable methods for # with args (3)
      1 (continue) Call # again
      2 (abort) Return to top loop level 0.

    Type :b for backtrace or :c  to proceed.
    Type :bug-form "" for a bug report template or :? for other options.
> Some compilers may add less runtime checks and will create specialized code -> less safe.

There is another misconception. Nobody forces me to use those compilers or use them in an unsafe mode.

The choice of compilers in Common Lisp is to give the user different tools for different situations. It does not force me to run my code containing type declarations in an unsafe mode - which usually is controlled by compiler switches: OPTIMIZE qualities for SAFETY, DEBUG and SPEED.

If I set safety to 3, most compilers will not create unsafe code - even though there are type declarations.

If we have a type violation in a CLOS method, SBCL even catches that:

    * (defmethod baz ((s string)) (+ s 10))
    ; in: DEFMETHOD BAZ (STRING)
    ;     (+ S 10)
    ; 
    ; caught WARNING:
    ;   Derived type of S is
    ;     (VALUES STRING &OPTIONAL),
    ;   conflicting with its asserted type
    ;     NUMBER.
    ;   See also:
    ;     The SBCL Manual, Node "Handling of Types"
    ; 
    ; compilation unit finished
    ;   caught 1 WARNING condition
    WARNING: Implicitly creating new generic function COMMON-LISP-USER::BAZ.

    #
The developer then will fix that code. When it then runs on another Lisp -> benefit.

So my advice usually is: even if one develops for another Lisp implementation, additionally use SBCL to check your code.

Re: Common Lisp homepage

#159

This is not good , the info density for the screen area is too low. This could have been one maybe two screens worth. Is this the credits to Friends? Am I consuming Lisp Content while chillin in my penthouse on my 20k couch using a gold plated IPad X Tablet? Millennials are Killing Common Lisp. one page, https://www.rust-lang.org/en-US/

The Racket-Lang site almost had it perfect: http://racket-lang.org/ The stuff above the language description should be shoved to the bottom (excluding obviously the top menu) and it would be perfect. I miss their old site because it was obvious and to the point and had examples right away.

Huh? If I exclude completely uninteresting "Racket School 2018" announcement, I have 18 words (plus some pointless images) on the first screen.

Oh, apparently I'm supposed to hover over the images to see more text. Why?!

Re: Common Lisp homepage

#160
post #7

Lisp is quite popular at my current workplace. A few popular open source projects published by our organization have been written in Clojure (a dialect of Lisp that runs on JVM and CLR). A few domain specific languages used internally in our organization are also inspired by Lisp. On a more personal front, I find Lisp to be simple, elegant, and expressive. I use Common Lisp (SBCL) for personal use. Working with Lisp…

>I sometimes wonder why Lisp has not been more popular in the technology industry. Is it the lack of sufficient marketing?

In the late 70s, cheap computers (IMSAI, Altair) were almost unable to run Lisp for useful purposes. Too little memory.

Minicomputers (DEC PDP /etc) were able to run full Lisp implementations but it worked slower than using other languages.

Lisp Machines (MIT CONS, etc) were able to run Lisp fast but those were dedicated, specialized hardware. And expensive.

Enter the late 80s; Lisp ran great on personal computers but implementations AFAIK were mostly commercial, so reserved to big budgets. I'd say Common Lisp did have success on the industry, used for many things (3D, CAD/CAM, simulation, etc).

Meanwhile the rest of the world was on Pascal, C, and C++.

Nowadays things are different, there are many Common Lisp implementations that are free and are good (SBCL and CCL, for example, are lightning fast).

But additionally, it is difficult to understand what advantages would Lisp bring. For this, the developer would have to grok (completely understand) the enormous value of metaprogramming, and to understand as well how flexible is CLOS.

Post reply on HN