News for hackers. Stuff that matters.
Re:History of Lisp Parentheses (2019) by revskill on Thursday February 02, 2023 @06:05AM (#34624979)
How to express try catch block in Lisp then ? In all programming language, composability was broken at exception handling.

No, instead of teaching 2 + 2 = sum (2, 2), i will teach the GOTO statement.

Re:History of Lisp Parentheses (2019) by lispm on Thursday February 02, 2023 @07:36AM (#34625698)
Common Lisp has a bunch of that stuff. For example HANDLER-CASE

http://www.lispworks.com/documentation/HyperSpec/Body/m_hand...

Re:History of Lisp Parentheses (2019) by tmtvl on Thursday February 02, 2023 @07:53AM (#34625844)
A try-catch block?

  (handler-case (/ 1 0)
     (division-by-zero (condition)
       (format nil "We caught ~S." condition))
     ((or file-error parse-error type-error) (condition)
      (format nil "We should never catch ~S" condition))
     (:no-error (result)
       (declare (ignore result))
       "We should never get here."))
That's an example of how it can be done in CL, in Scheme you've got guard.

  (guard (con
          ((warning? con)
           "We should never get this.")
          ((assertion-violation? con)
           "We should get this."))
    (/ 1 0))