More things I need to re-learn: the optimal number of function argumetns is 0, but 1 is OK. More than 3 is a recipe for bugs.

@liw That seems especially true for dynamic languages or static languages where a function has multiple arguments with the same type.

@cstanhope I agree partially, but it's also true for C and languages like that. A C function that gets a long list of arguments can often easily be called with arguments in the wrong order. It may be a little easier to catch in C, but only when the arguments are of incompatible types.

The number of types I've called strcpy(src, tgt) is scary, and it's not always possible to have src be const.

Or was it strcpy(tgt, src)?

This is not a language comparison fight.

@liw No fight from me! :) I was just thinking it through about how broadly your observation applies and how it even applies with static languages. Every time I have a functions whose argument list seems to be growing, I start to think of ways to reduce it or make it harder to to call it wrong. Although, I admit I spend more effort on public facing functions than private ones.

@liw And static types don't help when things are silently cast too... Oh my gosh, I'm having flashbacks...

Sign in to participate in the conversation
Mastodon @ SUNET

mastodon.acc.sunet.se is run by the Academic Computer Club at Umeå University located in Umeå, Sweden. ACC is actively involved in several open source projects and we provide mirrors for Debian, Ubuntu, Gnome and GIMP. We also host servers for the Gimpnet, Freenode, and OFTC IRC networks. You can read more about our projects and our servers on the ACC website.

Registration is open to the public, but we ask you read over and comply with our terms of use.