4 ms·
One example would be this: > If you misspell a variable [...], you discover this at run time. Ouch. CL-USER> (defun square (n) (* nn n)) ;; Ouch! nn isn't d
by emiljbs 13y ago
One example would be this:
> If you misspell a variable [...], you discover this at run time. Ouch.
CL-USER> (defun square (n) (* nn n)) ;; Ouch! nn isn't defined!
; in: DEFUN SQUARE
; (* NN N)
;
; caught WARNING:
; undefined variable: NN
;
; compilation unit finished
; Undefined variable:
; NN
; caught 1 WARNING condition
SQUARE
- DanWaterworth 13y agoIt is true of other dynamic languages and there isn't any way to fix that.
- Ovid 13y agoSorry, many dynamic languages prevent against this. For example: $ perl -Mstrict -E 'say $foo' Global symbol "$foo" requires explicit package name at -e line 1. Also, his comment about properties on objects is very debatable, too. Ignoring that the term "property" is overloaded and not defined, since I use roles (see: http://www.slideshare.net/Ovid/inheritance-versus-roles-1799996 http://www.slideshare.net/Ovid/inheritance-versus-roles-1799...), I find out at compile time if my classes are missing an attribute or method (actually it's composition time, but that's splitting a hair that most will never notice). In short, I don't get frantic 2AM phone calls about a batch process trying to call a non-existent method.
- icebraining 13y ago$ cat err.py def a(): print b $ pylint -E err.py ************* Module err E: 2,8:a: Undefined variable 'b'
- tetha 13y agoPractically speaking, this is helpful, indeed. Technically speaking, the more reflection a language provides, the less correct this becomes. Python code can dynamically inject local variables into stack frames, attributes into objects and so on in more or less silly and probably non-portable ways. So in the end, you end up with pragmatic correctness for mostly sane code. If that's enough for you and your project, go with it.