I wonder can anyone explain the design rationale behind the following features of autolisp / visual lisp? To me they seem to fly in the face of accepted software practice ... am I missing something?
- All variables are global by default (ie unless placed after a
/
in the function arguments) - Reading/writing data from autocad requires putting stuff into an association list with lots of magic numbers.
10
means x/y coordinates,90
means length of the coordinate list,63
means colour, etc. Ok you could store these in some constants but that would mean yet more globals, and the documentation encourages you to use the magic numbers directly. - Lisp is a functional-style language, which encourages programming by recursion over iteration, but tail recursion is afaik not optimised in visual lisp leading to horrendous call stacks - unless, of course you iterate. But loop syntax is very restrictive; e.g. you can't break out of or return a value from a loop unless you put some kind of flag in the termination condition. Result, ugly code.
- Generally you are forced to declare variables all over the place which flies in the face of functional programming - so why use a functional(-ish) language?