News for hackers. Stuff that matters.
Re:Why do long options start with two dashes? (2019) by devenblake on Thursday April 08, 2021 @06:51PM (#26744794)
Why did POSIX disallow +options?
Re:Why do long options start with two dashes? (2019) by pdw on Thursday April 08, 2021 @07:12PM (#26744922)
The shell uses "-" to enable an option and "+" to disable it. I don't know who's to blame for this, but it's part of the POSIX standard.
Re:Why do long options start with two dashes? (2019) by naikrovek on Thursday April 08, 2021 @08:14PM (#26745361)
> The shell uses "-" to enable an option and "+" to disable it.

things like this are how I know that there are too many people who are absolutely insane and who make mundane decisions.

    - to add
    + to subtract
absolute genius. is this what higher education teaches people? I didn't go to college, and maybe that was best.
Re:Why do long options start with two dashes? (2019) by dogecoinbase on Thursday April 08, 2021 @09:36PM (#26745856)
One of my favorites is in POSIX date format strings:

    %p     locale's equivalent of either AM or PM
    %P     like %p, but lower case
Re:Why do long options start with two dashes? (2019) by eyelidlessness on Thursday April 08, 2021 @08:42PM (#26745541)
Weirdly, this kind of syntactic idiosyncrasy is something that got me interested in Erlang. Finally a language that uses full stops when a routine full stops. I find most of the rest of its syntax uncomfortable (I didn’t spend much time with the language, I’m sure it’s fine when you’re used to it), but I always found it weird to end a completed statement with a statement-list-joining punctuation mark.
Re:Why do long options start with two dashes? (2019) by samatman on Thursday April 08, 2021 @10:23PM (#26746072)
This was inherited from Prolog, which ends terms with a full stop.

Most other languages didn't want to handle the syntactic ambiguity of using the period as a decimal point and a statement separator.

Re:Why do long options start with two dashes? (2019) by eyelidlessness on Thursday April 08, 2021 @10:37PM (#26746138)
I thought of mentioning the Prolog heritage. Weirdly CSS (having the worst syntax consistency of any language I can think of) is hyphen-heavy and solves its negation infix operator ambiguity well: it needs to be surrounded by whitespace.

For Prolog/Erlang, I think the preceding syntax is disambiguating enough

Re:Why do long options start with two dashes? (2019) by GoblinSlayer on Friday April 09, 2021 @05:48AM (#26748539)
COBOL terminates some statements with a period. And before that FLOW-MATIC https://en.wikipedia.org/wiki/FLOW-MATIC
Re:Why do long options start with two dashes? (2019) by eythian on Friday April 09, 2021 @05:20AM (#26748369)
> I always found it weird to end a completed statement with a statement-list-joining punctuation mark.

But if you're producing a list of statements, isn't a statement-list-joining punctuation mark the perfect thing to use?

There's also the difference in different languages between statement separators and statement terminators, but I don't really know enough about it.

Re:Why do long options start with two dashes? (2019) by weinzierl on Friday April 09, 2021 @03:51AM (#26747779)
I always thought this is a Wirthism because Pascal ends unit and program with an "end." (with a dot), whereas function and procedure are terminated with "end;". (with a semicolon). I don't know about other Wirth languages though, maybe it is Pascal specific and not really something typical for Wirth?
Re:Why do long options start with two dashes? (2019) by macintux on Thursday April 08, 2021 @11:37PM (#26746422)
The punctuation in Erlang mirrors English so closely I find it frustrating when people complain about it.

It's incredibly simple. Comma means "and", semi-colon ends a clause, full stop closes out the entire thought.

Re:Why do long options start with two dashes? (2019) by toast0 on Friday April 09, 2021 @03:42AM (#26747726)
Erlang is great, and I got used to the punctuation, but it's kind of a pain when you're moving code around.

Oh, now this is the last thing, gotta take off the ; or replace a , with a .

At least when I was starting out, I'd have loved a more C-like syntax with {} and consistently semicolons. Of course, Elixir came and just got rid of most punctuation, which I like less.

Anyway, it's consistent and after a couple weeks of messing it up, I can consistently see where the mistake is from the compiler error; after several years, I still sometimes mess it up, but oh well. I can't recall having messed up the punctuation so much that it still compiled but wasn't what I meant, so it's almost always quick to recover.

Re:Why do long options start with two dashes? (2019) by antonvs on Friday April 09, 2021 @01:36AM (#26747051)
That's not a plus sign, it's a crossed-out hyphen
Re:Why do long options start with two dashes? (2019) by Y_Y on Friday April 09, 2021 @03:47AM (#26747752)
> "that's a smile, not an upside-down frown!"
Re:Why do long options start with two dashes? (2019) by throwawayboise on Thursday April 08, 2021 @08:59PM (#26745665)
+ is the opposite of -. Not too hard to remember.
Re:Why do long options start with two dashes? (2019) by niceairport on Thursday April 08, 2021 @09:14PM (#26745758)
Or just think about all options as being prefixed with a "-"
Re:Why do long options start with two dashes? (2019) by _carbyau_ on Thursday April 08, 2021 @07:20PM (#26744974)
I can kind of see it as an ASCII art flowchart line.

IE a line to indicate use of this option and a line with a strikethrough to indicate it has been "struck out" as an option.

But using the conventional minus and plus symbols is indeed confusing.

Re:Why do long options start with two dashes? (2019) by saurik on Thursday April 08, 2021 @07:42PM (#26745149)
I mean, if you want to undo subtracting something, you add it? The only reason I ever found it confusing is that it was "backwards", but that feels like a forced error due to + requiring a shift while - doesn't.
Re:Why do long options start with two dashes? (2019) by smallnamespace on Thursday April 08, 2021 @07:52PM (#26745206)
"-" doesn't require hitting the shift key. Making the common case easy seems like a reasonable argument.
Re:Why do long options start with two dashes? (2019) by wahern on Thursday April 08, 2021 @07:31PM (#26745062)
You could ask Richard Stallman himself, who is well known for responding to random inquiries from people.

Presumably it was rejected because the whole point of POSIX was to consolidate, regularize, and simplify pre-existing practice. Adding "+" as an additional standard option signifier would take a huge step in the complete opposite direction. The only precedence for "+" would have been the `set` shell builtin, and AFAIU the committee only begrudgingly grandfathered that syntax.

Someone elsethread mentioned the `date` utility, but if you look at the BSD implementation "+" isn't used as an option marker, per se, but rather to disambiguate operand strings. The 2001 standard only defined the following:

  date [−u] [+format]
  date [−u] mmddhhmm[[cc]yy]
It's splitting hairs, but POSIX was at least able to shoehorn the legacy syntax into a more regularized base interface.