Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.


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


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.


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.


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


COBOL terminates some statements with a period. And before that FLOW-MATIC https://en.wikipedia.org/wiki/FLOW-MATIC


> 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.


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?


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.


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.


That's not a plus sign, it's a crossed-out hyphen


> "that's a smile, not an upside-down frown!"


+ is the opposite of -. Not too hard to remember.


Or just think about all options as being prefixed with a "-"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: