I'm porting some code from Python, and the biggest pain point so far is the lack of optional parameters.
It is painful for me to have to choose between clumsy parameter lists or multiple versions of the same function, possibly leading to a combinatorial explosion of the same function with different names if there are a number of valid parameter combinations.
Secondly, it makes the standard library look silly. Function(), Function1(), Function2(), with the only differences being an extra parameter thrown in.
An optional parameter could work like this:
sub function_name (p1, p2, optional p3=0)
This means valid calls to the function would be:
function_name (p1, p2)
function_name (p1, p2, p3=99)
Please? A Christmas gift? *smile*
It is painful for me to have to choose between clumsy parameter lists or multiple versions of the same function, possibly leading to a combinatorial explosion of the same function with different names if there are a number of valid parameter combinations.
Secondly, it makes the standard library look silly. Function(), Function1(), Function2(), with the only differences being an extra parameter thrown in.
An optional parameter could work like this:
sub function_name (p1, p2, optional p3=0)
This means valid calls to the function would be:
function_name (p1, p2)
function_name (p1, p2, p3=99)
Please? A Christmas gift? *smile*