5 ms·
An exclamation point being part of a function's name is certainly surprising to me. It would be like learning that `foo[5]` was a function named `foo[` being ca
by Noumenon72 5y ago
An exclamation point being part of a function's name is certainly surprising to me. It would be like learning that `foo[5]` was a function named `foo[` being called 5x or something..
(Apparently it's a ClojureScript convention to put an exclamation point on impure functions.)
- Dylan16807 5y agoEven though the blog is syntax highlighted?
- sixstringtheory 5y agoExclamation marks are also used in Ruby to differentiate between mutating methods vs those that return a transformed copy. So, `array.sort` vs `array.sort!`. Question marks are also used, but more aesthetically vs functionally: there are `array.empty?` and `array.include?` but no `array.empty` or `array.include`. Swift allows unicode in symbols, so you can name functions with emoji. Thankfully that hasn’t caught on. J has a similar idea–built into the language syntax vs using characters in function names–where a period can be used to inflect a primitive.