3 ms·
There are a few things present in COBOL that I would like to see lifted into more modern languages. One is the use of the full stop as an expression terminator,
by pjc50 7y ago
There are a few things present in COBOL that I would like to see lifted into more modern languages. One is the use of the full stop as an expression terminator, as in English, instead of the semicolon. Another is the whole "picture" mechanism for number formats.
More languages should also steal Verilog's use of _ as an optional digit separator. It's just arrived in C# 7.
- gerikson 7y ago"_" has been an option to separate digits in Perl for ages. I use it all the time if the integer is >10,000
- guggle 7y agoI think Nim also has digit separator.
- nimmer 7y agoIt does.
- abrolhos 7y agoC++ has an optional digits separator too. Not '_' but single quotes, since c++14 [0]. Which is cool. Swift has it too [1]. Erlang has the full stop '.' as expresssion/statement terminator [2]. [0] https://en.cppreference.com/w/cpp/language/integer_literal https://en.cppreference.com/w/cpp/language/integer_literal [1] https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID414 https://docs.swift.org/swift-book/ReferenceManual/LexicalStr... [2] https://erlang.org/doc/getting_started/seq_prog.html https://erlang.org/doc/getting_started/seq_prog.html I like those features too! I'm glad they are coming to contemporary languages.
- onychomys 7y agoIf we start using periods to end expressions, would we then have to use semicolons to chain things together? Or would you let the compiler know that foo.size(). was okay and that it shouldn't be waiting around for another function call there?
- lifthrasiir 7y agoJuxtaposition (`foo size()`) is a serious contender I think. In fact, I consider it is one of the most undervalued syntactic choices.
- WorldMaker 7y agoIn HS I built a toy language where it was `foo's size()`, if you want to play even further down the English-like rabbit hole, even trying to stick to BNF-ish CFGs. `'s` is actually a surprisingly unambiguous token in a language without a "char type" and that sticks to double quotes only for strings.
- marcosdumay 7y agoHum... Prolog uses periods to end declarations, and as you expect, uses semicolons as combinators. It reads really well, because it also uses colons as combinators, with higher precedence than the semicolon. But it does not map well into other paradigms.
- pjmlp 7y agoJava has it since ages.
- pansa2 7y ago`_` digit separators are also supported by both Python and Go.
- DFHippie 7y agoTo extend this list a bit, Rust and Ruby also allow _ as a separator.
- macintux 7y ago> One is the use of the full stop as an expression terminator, as in English, instead of the semicolon. That’s something people complain about when looking at Erlang code. Thanks to its Prolog heritage, it uses commas, semi-colons, and full stops to terminate statements. It’s actually very easy to remember which is which, despite the general angst, because they are directly analogous to those punctuation marks’ usage in English. Commas indicate a continuation of statements, semi-colons separate clauses within a function, and full stops complete a function definition.
- mjcohen 7y agoI also liked the "corresponding" modifier for verbs like "move" and "add". It caused the operation to only be done on those fields which existed in both the source and destination and ignored the others. Do any other languages have this?