3 ms·
Forgot to add.. in common lisp everything is kebab-cased which makes case a lot less significant. Not sure what happens in Nim?
by weavie 8y ago
Forgot to add.. in common lisp everything is kebab-cased which makes case a lot less significant. Not sure what happens in Nim?
- mratsim 8y agokebab-case? Is that even a thing?
- mhd 8y agoNot as common, as it clashes with using '-' for subtraction, but as that's never been a problem for Lisp, it's quite common there. Perl6 went that way, too, despite having infix syntax. But hey, it's Perl, we're used to syntactical warts.
- weavie 8y agoAh.. I had wondered why it wasn't used in most other languages. Now, of course it seems obvious.
- klibertp 8y agoSure, Lisps allow many more characters in the identifiers, including all traditional operators (makes sense, since the "operators" are just functions and they had to be defined somehow in the first place...) You get functions named like add-message! create-response/text bytes->string/utf-8 and so on. Kebab case refers to identifiers with words separated with minus sign, like some-class-member-doing-something etc. Some infix languages borrowed this, like Dylan and LiveScript, among others.
- Jach 8y agoCommon Lisp actually lets you use any string for an identifier if you wrap it in pipes, though you have to be a bit careful of casing in that case. Still for so many characters on the keyboard it's not needed to wrap which is so convenient as you illustrate. (let ((|hello world| 3) (|HELLO world| 4) (|こんにちは (jp)| 5) (|pi\|pe| 'piped) (|newlines work too| 6)) (list |hello world| |HELLO world| |こんにちは (jp)| |pi\|pe| |newlines work too|)) ; --> (3 4 5 PIPED 6)
- vram22 8y agoSure it is. Think of what it looks like, and think of a skewer with kebabs on it ... Search HN (box at bottom of page) for Perl6 and you will find many articles with references to kebab-case. As mhd said, it's used in Lisp too.
- fao_ 8y agoIt's actually easier on the hands than using `_`. As on a standard (us, uk, chinese, etc.) keyboard underscore requires a shift-press whereas minus/hyphen requires a single press. It's a small change but you'd be surprised how much of a difference it makes, given that tokens are a significant amount of all writing when programming. Not to mention, in my opinion it's more aesthetically pleasing, but that's just me :)
- mikepurvis 8y ago> looks-like-this http://wiki.c2.com/?KebabCase http://wiki.c2.com/?KebabCase