3 ms·
Ask HN: Good ideas for naming functions
I've came across the extra vocabularies such as `?`(return boolean) and `!`(destructive) for naming functions and variables. IMO they are much better more intuitive than names such as `is_...`, and I can't think of a good way to name destructive functions in language such as Python, C, java.
Is there a good convention/idea to name your functions wisely that are less verbose and straight to the point?
- dudul 11y agoSome languages use mathematical symbols to name functions that are derived from mathematical rules/principles (e.g. the Scalaz library). I think it's a good idea. If you're implementing function composition, just use the mathematical symbol for composition, don't pull a new name out of a hat. A lot of people complain about it, the main reasons being: - it's annoying to type - a lot of developers actually don't have a math background and have no idea what the symbols mean