News for hackers. Stuff that matters.
Re:Why I still Lisp by base698 on Sunday January 31, 2021 @11:36AM (#25979979)
Agree with him. Coming from an OO background I always cringed at the 15,000 line classes with 2000 line methods. Side effects everywhere.

In my naivety I thought functional programs with their emphasis on lack of side effects could help. I then encountered a project that was totally functional but written entirely by people with no functional experience. The entire application was unmaintainable even in the most basic parts.

> Doesn't parse

> Macros

Macros modify code structure at runtime so obviously that is fraught with danger.

> Framework forcing structure

Lisp languages in general have a do it yourself attitude not found in others. While there are frameworks it's common to find projects that have invented from the ground up entire web frameworks, db access and orm.

Imagine if every project you encountered in Java reinvented Rx Java, Hibernate, and Spring.

Re:Why I still Lisp by SomeHacker44 on Sunday January 31, 2021 @12:03PM (#25980257)
> Macros modify code structure at runtime so obviously that is fraught with danger.

You may have inadvertently misspoke, but macros operate at compile time, at least in the Lisps I have used.

Re:Why I still Lisp by lispm on Sunday January 31, 2021 @01:50PM (#25981371)
If one uses a Lisp interpreter, macro expansion may happen at runtime.

CLISP example:

  [2]> (defmacro add2 (place) (print 'add2) `(incf ,place 2)) 
  ADD2
  [3]> (let ((a 1)) (dotimes (i 4) (add2 a)))

  ADD2 
  ADD2 
  ADD2 
  ADD2 
  NIL
  [4]> 
As one can see the macro form is expanded four times at runtime.
Re:Why I still Lisp by dzsekijo on Sunday January 31, 2021 @05:36PM (#25983302)
This is a confusing example, because in a REPL steps of compilation and evaluation are interleaved.

Indeed, can you write a program for CLISP that works like this:

- takes one command line argument (a file name)

- reads in the given file, interprets it as Common Lisp code, expecting it to deliver a definition for the add2 macro

- then runs

   (let ((a 1)) (dotimes (i 4) (add2 a)))
Re:Why I still Lisp by lispm on Sunday January 31, 2021 @05:58PM (#25983458)
> This is a confusing example, because in a REPL steps of compilation and evaluation are interleaved.

The CLISP REPL does not compile, thus it can't be interleaved.

> then runs

It will still be interpreted and the macro will still be expanded at runtime.

Re:Why I still Lisp by vram22 on Sunday January 31, 2021 @02:05PM (#25981511)
I don't know Lisp well, but I remember PG saying in one of his books or essays, that Lisp is a language in which you can compile and run at read time, and the other two possibilities, too.
Re:Why I still Lisp by ludston on Sunday January 31, 2021 @06:45PM (#25983848)
Macro's are evaluated inside of 'defun, however, 'defun is evaluated during runtime (when the .lisp file is being loaded into the implementation) so base698 is technically correct.

Excepting that it is not really "fraught with danger" unless you are redefining macro's that have already been expanded and cached in function definitions.

Re:Why I still Lisp by lmilcin on Sunday January 31, 2021 @02:48PM (#25981902)
In full Lisp "compile time" is part of application execution.

Now, Clojure is kind of impaired Lisp because it is written for a VM that was not intended to be used this way and so this is not that much pronounced (but you still get REPL, etc.)

Re:Why I still Lisp by thu2111 on Monday February 01, 2021 @12:42PM (#25990993)
Is there anything lacking from the JVM beyond tail-call elimination that Lisp needs? I know Clojure is very slow to start up but my understanding is that this is because it uses the JVM very inefficiently, and they don't seem to care much.
Re:Why I still Lisp by rpdillon on Sunday January 31, 2021 @11:54AM (#25980152)
I'm a big fan of Racket, and while I don't write very many macros, my understanding is that in both Common Lisp and Racket, macros are essentially a compiler pass, with no modification at runtime.

https://docs.racket-lang.org/guide/macros.html