4 ms·
Could you elaborate a few specific points on this? Curious because I'm on the same boat. I was annoyed for a while how ruby convention uses '?' characters at
by spicybright 5y ago
Could you elaborate a few specific points on this?
Curious because I'm on the same boat.
I was annoyed for a while how ruby convention uses '?' characters at the end of method names that return a boolean.
I'm not even that old and I still want to yell `[a-zA-Z0-9_]+` identifier names or get off my lawn.
- Jtsummers 5y agoWhy would you want to limit yourself so drastically in what you can express with function and variable names?
- Zababa 5y agoI don't think this is drastically limiting, it's a sane subset that gets you 99% of what you need from a function name.
- Jtsummers 5y agoWe use punctuation and symbols in typography and writing to provide clarity. Why not use it in our programs?
- Zababa 5y agoPrograms? Aren't we talking about variable and function names? But for the general case, Lisp does use puncuation and symbols. It just tends to use less. The other side of the balance is operators like ~+#>. Most languages are in the middle ground. All of these options are fine and have their uses. I wouldn't like to see stuff like ~+#> every day, but I like being able to implement <.
- Jtsummers 5y agoPrograms are composed of those things.
- Zababa 5y agoSure, but you don't use a lot of punctuation in identifier names. For example, in JS: function sumOfArray(arr) { return arr.reduce((sum, element) => sum + element, 0) } Now in Scheme: (define (sum-of-list lst) (reduce + 0 lst)) Both have punctuation, but usually not in the identifiers (except for - and _)
- gpderetta 5y agoIn fact we do, but as in typography you do not use punctuation to write words. Then again, I really like '-' in symbol names.
- spicybright 5y agoI don't, I always follow whatever convention the langue/code base uses. I'm just saying like GP I'm shallow and prefer C style identifiers where it makes sense to.
- dunefox 5y agoIn Julia, the convention is that a function like "swap!" modifies its input. It's extremely handy. Also, "odd?" is just an elegant way to name a predicate.
- theodorethomas 5y agoI saw that convention in IBM/NAG's Scratchpad/Axiom computer algebra system which was designed in the 80s. It may go further back than that.