bbatsov / emacs-lisp-style-guide

A community-driven Emacs Lisp style guide
1.08k stars 53 forks source link

Not sure about dissuading scheme-style predicates #15

Closed shosti closed 9 years ago

shosti commented 10 years ago

The style guide recommends against ending predicate functions in ?, but some high-quality libraries (such as dash.el) use that style extensively and I don't really see a good reason to avoid it (the -p predicate functions always seem like something of an anachronism). I guess the bigger question is whether the style guide should always follow the internal Emacs coding guidelines (internally I think -p is always used). It's worth noting that there are already some recommendations that are not at all in line with what's done internally in the Emacs source code, such as avoiding hard tabs. Anyways, I'd just be interested in hearing people's thoughts on this.

bbatsov commented 10 years ago

To my knowledge @magnars is the only one pushing for this style and even he provides -p aliases for all predicates. This convention is extremely old and well established in the Emacs realm, so fighting against it doesn't make a lot of sense IMO.

Malabarba commented 10 years ago

I agree with @bbatsov.

Fuco1 commented 9 years ago

Yes, I also don't quite like the ? suffix usage, it looks weird to me. I even added the -p aliases to dash functions which were missing them some time ago to make it "emacs" compatible.

But then, most of the time I don't find the -p distinction useful either. Usually it just returns the value that a "non-predicate" would return anyway, so writing code like (when (has-element-p) (get-element)) can be equally well done with just (get-element) (you can even find wrappers that just do (not (null (foo)) to convert values to t or nil only, which is more than useless when emacs does that automatically.

If it can help performance, then it makes sense, but usually it doesn't.

shosti commented 9 years ago

OK, makes sense, I'll close the issue.