Am 09.01.2018 um 22:13 schrieb Allin Cottrell:
On Mon, 8 Jan 2018, Sven Schreiber wrote:
> Am 08.01.2018 um 10:21 schrieb Schaff, Frederik:
>> And then one other thing. In Python one can conveniently pass
>> optional arguments via “argument_label=argument_value”, without
>> having to care about the sorting/completeness of the argument list.
> [I]t would be nice to have, but I'm afraid that it would
represent a
> major internal reorganization effort.
Yes, it would be quite a major change.
But one (somewhat relevant) point is that it's now OK (in recent git) to
skip one or more optional arguments altogether, provided one inserts
commas to preserve the argument count where necessary.
That's also nice!
About the argument label thing again: I was wondering whether perhaps a
light version would be possible where the labels are irrelevant for
hansl / for the parser, but are there as decoration for the human
reader. That would also mean that the arguments are still positional and
must not be flipped around.
Example:
signature: function void hey(int arga[0], int argb[1], int argc[0])
...
possible calls:
hey( , argb = 3)
hey(arga = -1, , argc = 10)
The parser just would have to delete everything after a comma (or
opening call parenthesis) and up to (and including) the equal sign; and
watching out that something like 'arga == -1' is a different potentially
valid expression -- which of course would mean that '=' as a boolean
comparison would finally have to be banned I guess.
The downside might be that new gretl users mistake this for truly named
arguments and forget to honor the arg's position.
cheers,
sven