What is your ideal calling convention for methods? If you could just throw away everything you don't like about your current language(s) and start over, how would you do it?
A:
This is the list of stuff I consider to be bad about the ones I'm using.
- Hard to distinguish between function names and arguments (Lisp, F#)
- Having to count arguments/parameters to figure out which map to which (C#, Java)
- Having to specify types on generic calls when they should be inferable (VB, C#)
- Having to explicitly cast when an implicit cast would be obviously safe (F#)
- Not supporting a variable numbers of parameters
- Not supporting optional parameters (C#, Java)
- Not supporting overloads (VB 6)
- Not supporting lists of tuples (VB, C#, Java)
- Fields and properties are accessed differently (Java)
- Array syntax is special cased for built-in types (Java)
- Arrays are accessed differently (C#)
- Default Properties (VB 6)
- Methods not needing parameters require an empty parameter list (Java, C#)
- Calling functions and calling methods look different (F#)
- Calling functions that return values are different from ones that don’t (VB 6)
Jonathan Allen
2009-06-17 21:07:29
A calling convention is what describes how arguments are passed from a caller to a receiver and how they are cleaned up once the call is finished. Your answer doesn't talk about that, though; it's just a simple list of gripes with no real theme.
Rob Kennedy
2009-06-17 21:32:33