|
|
|
|
|
by aidenn0
3506 days ago
|
|
> Style is concerned with the appearance of the code, and is largely subjective. Many languages, like Common Lisp and Java, have got this nailed: the same style is used everywhere. In the C world, there are endless arguments about levels of indentation, the position of braces, etc. I'm struggling with where to first disagree with this. Some style guides deal only with code appearance, but they can also include things like preferred iteration mechanisms, maximum function lengths or even cyclomatic complexity. Comon Lisp doesn't even remotely have standardized style; ask a dozen CL programmers how they would perform an operation on each element of a list and you'll get answers including: MAPCAR, MAP, DOLIST, LOOP, ITERATE. It does have a standard for indentation, which is roughly "however emacs would indent your code" but that breaks down when DSLs get involved (see how different people indent LOOP for an example). [edit] One simple example of a style guide entry that is not primarily concerned with the appearance of code. There are dozens more in that one style guide: https://google.github.io/styleguide/lispguide.xml#EVAL |
|
Maximum function lengths and cyclomatic complexity are important but I'd put those under standards.
Lisp gives you a lot of flexibility regarding how you do things, but once you choose a way, that constrains how your code should be laid out, i.e. its style. EMACS indents code in the accepted Lisp style. It doesn't define it. It implements it.
Saying you should avoid eval at run time is a coding standard, not style.