Hacker News new | past | comments | ask | show | jobs | submit login

I don't like many parameters either and I come more from js/php land where mix-types is okay, but couldn't a mixed type hash or array work or just a json object which presumably could allow mixed types since json is a standard but doesn't require all properties to be of a specific type...

I'd much rather have func test(data){ return 'The ' + data.type + ' is ' + data.value + ' and the sum is ' + data.value1 + data.value2; }

I can easily validate data in the json object or multi-dimensional array or hash or w/e the language I'm working in calls it, and call it a day.

If I need to make it 'understandable' by other devs I'll add a detailed comment section on what all the 'required' data properties are and what not.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: