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.

Charles Stanhope
Follow

@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
social.coop

social.coop is a a coop-run corner of the fediverse, a cooperative and transparent approach to operating a social platform. We are currently closed to new memberships while we improve our internal processes and policies, and plan to re-open to new folks when that work is complete. [9/2/2018]