Hacker News new | ask | show | jobs
by dragonwriter 931 days ago
> Why is this a feature in every new language?

Because superfluous type checker incantations are, aside from breaking up flow of thought when writing code, annoying visual noise when reading it.

> I'd love it if named parameters were mandatory, not optional.

Named parameters are a different thing than type incantations, and I agree that it would be good for any non-operator function that takes more than 1 argument to require named parameters.

2 comments

>Because superfluous type checker incantations are, aside from breaking up flow of thought when writing code, annoying visual noise when reading it.

I disagree. Implicit typing for the most part makes things harder read. The less I have guess about what type something is the better. I never use stuff like "var" or "auto", unless forced to for this very reason.

I don't see the value of, say, dot_product(vector1=x, vector2=y) compared to dot_product(x, y).
> I don't see the value of, say, dot_product(vector1=x, vector2=y) compared to dot_product(x, y).

I would include functions which implement (especially unary/binary) mathematical operators where the operands either are interchangeable or have a clear conventional order, in languages where you cannot make them actual operators, within the exception for operators.

2 parameters are usually fine, but then I have seen quite a few bugs with atan2(y,x).