10-19-2023, 03:37 PM
You should give C++ and Pure Basic programmers more credit for knowing what they're doing.
In Pure Basic there's no choice, must use pointer to pass an UDT variable to a subprogram. But it looks like folks that use that programming language prefer that over a subprogram that takes 30 parameters and sometimes only four or five of the optional ones are chosen. IIRC cannot have commas in the midst for an user procedure call in that BASIC dialect, but could have optional parameters from the end of the parameter list.
Good programming practice is to allocate a "dummy" UDT variable which has its fields set to "defaults" or cleared out. Then before calling the subprogram that will work with an UDT variable, first set that variable to the value of the "dummy". But not everybody will be eager to do that, or could forget to do it.
What I know is, I don't like much more than 10 parameters to a call to any subprogram. I remember Ethan Winer's book for the "full-blown" `Editor` subprogram. Somewhere in the book, however, he offered a cut-down version which doesn't care about screen position and colors and a few other things. I much preferred the 4-parameter `Editor`. I used it a lot, until I ran into trouble with a QB64 program. This program inexplicably returned many junk keys and despite my efforts to fix it, `Editor` was unusable for that purpose.
In Pure Basic there's no choice, must use pointer to pass an UDT variable to a subprogram. But it looks like folks that use that programming language prefer that over a subprogram that takes 30 parameters and sometimes only four or five of the optional ones are chosen. IIRC cannot have commas in the midst for an user procedure call in that BASIC dialect, but could have optional parameters from the end of the parameter list.
Good programming practice is to allocate a "dummy" UDT variable which has its fields set to "defaults" or cleared out. Then before calling the subprogram that will work with an UDT variable, first set that variable to the value of the "dummy". But not everybody will be eager to do that, or could forget to do it.
What I know is, I don't like much more than 10 parameters to a call to any subprogram. I remember Ethan Winer's book for the "full-blown" `Editor` subprogram. Somewhere in the book, however, he offered a cut-down version which doesn't care about screen position and colors and a few other things. I much preferred the 4-parameter `Editor`. I used it a lot, until I ran into trouble with a QB64 program. This program inexplicably returned many junk keys and despite my efforts to fix it, `Editor` was unusable for that purpose.