Optional parameter requests - any more?
Posted: Sat Sep 20, 2014 2:08 am
Another low-priority request
Over the years, many mandatory parameters have become optional, where it makes sense.
Here are some common functions with parameters that (I believe) could be made optional! (Usually default to 0 or "").
This would not be a functional change. Just a change for cleaner code. Feel free to suggest more!
EDIT: This is about just converting mandatory parameters to optional.
Not to be confused with this other active thread about leaving parameters in the middle of the list empty when calling, to use their defaults:
http://www.purebasic.fr/english/viewtop ... =3&t=60551
Currently the Date function either needs 0 parameters (returns the current timestamp) or 6 parameters (Year Month Day Hour Minute Second). It would be nice if you could use 3 parameters - often I specify a date by Year/Month/Day with the rest set to 0.
Pattern$ could default to ""
The DefaultValue parameters could default to 0 or ""
The *Value parameter could default to #Null
The Flags parameter could default to #Null. Maybe all the parameters (FontName and FontSize) could have defaults too, like ColorRequester?
DefaultString could default to ""
PatternPosition could default to 0

Over the years, many mandatory parameters have become optional, where it makes sense.
Here are some common functions with parameters that (I believe) could be made optional! (Usually default to 0 or "").
This would not be a functional change. Just a change for cleaner code. Feel free to suggest more!
EDIT: This is about just converting mandatory parameters to optional.
Not to be confused with this other active thread about leaving parameters in the middle of the list empty when calling, to use their defaults:
http://www.purebasic.fr/english/viewtop ... =3&t=60551
Code: Select all
Date
Code: Select all
ExamineDirectory
Code: Select all
ReadPreferenceDouble
ReadPreferenceFloat
ReadPreferenceInteger
ReadPreferenceLong
ReadPreferenceQuad
ReadPreferenceString
Code: Select all
CreateThread
Code: Select all
FontRequester
Code: Select all
InputRequester
Code: Select all
OpenFileRequester
SaveFileRequester