3 ms·
I'm not convinced that the C++ way is better here; either `fn` or `function` makes it clear that you're looking at a function (and incidentally makes it very ea
by saghm 7y ago
I'm not convinced that the C++ way is better here; either `fn` or `function` makes it clear that you're looking at a function (and incidentally makes it very easy to search for a function with a given name in a file), whereas just having the return type and then the function name makes it ambiguous until you read further whether you're looking at a variable or a function. If I see `fn size`, I know I'm looking at a function before I get to the parentheses, but if I see `int size`, that's still ambiguous until you go a character further.
- boring_twenties 7y agoUnfortunately, one character further is not enough to disambiguate the C++ syntax: int size(); Am I declaring a function returning an int? Or defining an object of type int and invoking the default constructor?