[PD] should 'flags' always come first?
IOhannes m zmölnig
zmoelnig at iem.at
Sun Feb 27 10:31:21 CET 2022
On 2/27/22 10:05, Alexandre Torres Porres wrote:
> Em dom., 27 de fev. de 2022 às 05:26, IOhannes m zmölnig <zmoelnig at iem.at>
> escreveu:
>
> Many objects in Pd are coded in a way to reject creation arguments in the
> wrong order. The bug would be that it allows it.
that's typically not how it works. see Postel's law.
flags are just a general expression of "named arguments" (where you
specify the meaning of a value along with the value; which is useful if
you have many and/or non-mandatory arguments),
in general, flags are most useful for cmdline applications.
so i think we should check how flags are andled there.
> - They start with "-".
in *general* i think it is safe to say that flags start with some common
prefix. the actual prefix may vary based on the ecosystem, with *plenty*
of exceptions.
- on Windows, cmdline flags often start with "/"
- GNU suggests to use "--" for long-name flags (e.g. "--verbose") and
"-" for short-name (single-character) flags (e.g. "-v")
- single dash is common as well (e.g. "-flags")
Pd has mostly adopted single-dash flags, both for cmdline args and for
arguments.
that doesn't mean that other suffixes (e.g. '@') are "bugs". they are
just uncommon.
- They're always optional
i don't think so.
i know programs that have obligatory flags (though they are uncommon;
and i can't remember the name of one right now; but i *know* that i know
some such programs)
- They come before "actual" arguments.
what do you mean by "actual arguments"?
I've never heard of anything like that. i guess you mean arguments that
are not "flags" (named arguments), but what is typically called
"positional arguments" (as their semantic is encoded in the position:
the 1st argument means something else as the 2nd arg).
so to conclude: i think you are overformalizing here, based on some
assumptions that do not hold.
in general, a rule for flags could be: is the meaing of an argument-list
ambiguous or not.
if it allows to specify ambiguous arguments, then there's a bug.
if not, then there's none.
fgdy
IOhannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20220227/e777a185/attachment-0001.sig>
More information about the Pd-list
mailing list