John Evans' Blog

Tag: computer languages

Polymorphic function arguments

by on Nov.17, 2008, under Uncategorized

I just had this curious thought…

If you’re programming, you call functions a lot. Functions often have parameters. Sometimes they can have a lot of parameters. Sometimes it’s hard to remember which parameters are which; like, if the function is supposed to be called like “function(int amount, int x, int y)” and instead you give it the parameters “function(x, y, amt)” then something’s going to go wrong. Now, granted, in modern IDEs and editors it’s usually quite simple to look up the function definition and make sure you’re calling it correctly.

However…What if you could call the function arguments in some other order, as long as you knew what they were? Something like this: “function(x: 2, y: 3, amount: 1)”. There would be some specifier to let the compiler associate the parameters with their values.

I feel like I’ve seen some language that had this facility, but at the moment I can’t remember what it was.

4 Comments :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...