4 ms·
Ask HN: Which function definition keyword do you prefer, def or fn?
I'm curious about what people think of `def` vs `fn`, two short keywords for starting function definitions.
...Or maybe we should subscribe to the church of `df`, haha.
- sitkack 1y agodef could be for lots of things, fn is for functions. I don't think it matters much as long as you have one. C would have been so much easier to parse. Just copy Zig or Rust.
- butlersean 1y agodef means define, could be used to define all kinds of things fn isnt a legitimate short form of function fun doesnt work because of the amusement factor func is the only alternative we have left
- sitkack 1y agoHow about unicode or emojis? These don't have the full fidelity as hn scrubs emojis add = (a, b) -> a + b a, b ⟹ a + b λ add(a, b): ↪ a + b
- johncoltrane 1y ago"def" is too generic. "fn" is too cryptic. "function" is better than the two.
- MultifokalHirn 1y agoAgreed