Comment

Comment by lispm

Using a Lisp compiler helps a bit.

  * (defun foo (alpha)
      (flet ((beta (bar)
               (+ alph bar)))
        (bet (beta 1 2))))
The Lisp compiler, here SBCL with its REPL, detects in this function above:

  * wrong number of arguments
  * undefined function
  * undefined variable
  * unused variable

Lisp compilers have only been made available as late as 1962, so that might explain why Lisp has no wider adoption...

  ; in: DEFUN FOO                                                                                                                                                 
  ;     (BETA 1 2)                                                                                                                                                
  ;                                                                                                                                                               
  ; caught WARNING:                                                                                                                                               
  ;   function called with two arguments, but wants exactly one                                                                                                   
  ;   See also:                                                                                                                                                   
  ;     The ANSI Standard, Section 3.2.2.3                                                                                                                        

  ;     (SB-INT:NAMED-LAMBDA FOO                                                                                                                                  
  ;         (ALPHA)                                                                                                                                               
  ;       (BLOCK FOO                                                                                                                                              
  ;         (FLET ((BETA #                                                                                                                                        
  ;                  #))                                                                                                                                          
  ;           (BET (BETA 1 2)))))                                                                                                                                 
  ;                                                                                                                                                               
  ; caught STYLE-WARNING:                                                                                                                                         
  ;   The variable ALPHA is defined but never used.                                                                                                               
  ; in: DEFUN FOO                                                                                                                                                 
  ;     (+ ALPH BAR)                                                                                                                                              
  ;                                                                                                                                                               
  ; caught WARNING:                                                                                                                                               
  ;   undefined variable: ALPH                                                                                                                                    

  ;     (BET (BETA 1 2))                                                                                                                                          
  ;                                                                                                                                                               
  ; caught STYLE-WARNING:                                                                                                                                         
  ;   undefined function: BET                                                                                                                                     
  ;                                                                                                                                                               
  ; compilation unit finished                                                                                                                                     
  ;   Undefined function:                                                                                                                                         
  ;     BET                                                                                                                                                       

  ;   Undefined variable:                                                                                                                                         
  ;     ALPH                                                                                                                                                      
  ;   caught 2 WARNING conditions                                                                                                                                 
  ;   caught 2 STYLE-WARNING conditions                                                                                                                           

  FOO
parent lispm 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton