News for hackers. Stuff that matters.
Re:“Swift is the only language I could find with over 100 ke... by blacktriangle on Friday July 30, 2021 @02:17PM (#28010723)
I don't think this is fair to Swift. Swift seems to have taken a view that the langauge will force you to be explicit about what you want. For example, the "indirect" keyword. Early Swift did not let you have recursive enums, apparently this can be something of a performance killer I guess was the reasoning. However they are really useful, so Swift added them. However rather than just automatically using an indirect Enum which is easily detectible, Swift forces you to use the "indirect" keyword. Rather than implicitly doing work for you, the Swift compiler stops to ask "are you sure this is what you really want to do? Do you understand the tradeoffs you are making?"

Personally I'm a fan of the Swift approach even if it does balloon the keyword count a bit.

Re:“Swift is the only language I could find with over 100 ke... by Gibbon1 on Friday July 30, 2021 @04:41PM (#28012122)
I feel it's better to add keywords like that than to over load keywords based on context. See the keyword const in C/C++.

Also better to trust the end used to decide what trade offs they want to make. For instance code that converts a user click to a database query, clean and understandable is more important than performance. If it takes 10ns or 10ms the user ain't going to know the difference.

Re:“Swift is the only language I could find with over 100 ke... by eesmith on Friday July 30, 2021 @03:10PM (#28011241)
Depending on how you count keywords, SQL has over 400. See https://github.com/ballista-compute/sqlparser-rs/blob/main/s... .

SQLite has 147 keywords - https://www.sqlite.org/lang_keywords.html .

Re:“Swift is the only language I could find with over 100 ke... by nn3 on Friday July 30, 2021 @03:18PM (#28011328)
COBOL has over 300 too
Re:“Swift is the only language I could find with over 100 ke... by eesmith on Friday July 30, 2021 @03:50PM (#28011668)
I count 417 reserved words at https://www.ibm.com/docs/en/iis/9.1?topic=words-cobol-reserv... .

I see there's "ZERO", "ZEROES", and "ZEROS" - I didn't realize that both plurals are acceptable in English! - https://english.stackexchange.com/questions/3824/what-is-the... .

My favorite reserved word on that list is "KANJI". From https://www.ibm.com/docs/en/cobol-zos/4.2?topic=expressions-... :

> The class condition determines whether the content of a data item is alphabetic, alphabetic-lower, alphabetic-upper, numeric, DBCS, KANJI, or contains only the characters in the set of characters specified by the CLASS clause as defined in the SPECIAL-NAMES paragraph of the environment division.

Re:“Swift is the only language I could find with over 100 ke... by vb6sp6 on Friday July 30, 2021 @01:35PM (#28010347)
VB6 has close to 300

And while some vb6 code is truly terrible, it isn't because of keywords. It's because beginners have no idea what they are doing.

So I imagine Swift code may be terrible because there are a lot of noobs out there doing whatever it takes to ship.

Re:“Swift is the only language I could find with over 100 ke... by hpen on Friday July 30, 2021 @02:53PM (#28011072)
And yet code in Swift is much cleaner than anything in Javascript. I say that having mostly written Swift & Javascript at my jobs and on the side.
Re:“Swift is the only language I could find with over 100 ke... by philwelch on Friday July 30, 2021 @04:57PM (#28012264)
JS is a fairly low bar to compare other programming languages to.
Re:“Swift is the only language I could find with over 100 ke... by hpen on Saturday July 31, 2021 @01:12AM (#28015467)
The point was to compare a "simpler" language
Re:“Swift is the only language I could find with over 100 ke... by igouy on Saturday July 31, 2021 @01:01AM (#28015432)
And used by many, so useful to compare to?
Re:“Swift is the only language I could find with over 100 ke... by addicted on Saturday July 31, 2021 @01:08AM (#28015457)
It’s only used by many because it’s the only scripting language on the web browser, and not due to anything intrinsic to the language.

So it’s popularity tells us nothing about the language, and more about the fact that it’s the only language on the most popular platform.

So I’m not sure comparing any language to JS is useful to learn about the language.

Re:“Swift is the only language I could find with over 100 ke... by igouy on Saturday July 31, 2021 @01:26AM (#28015528)
It’s popularity tells us many people will be able to relate to that comparison.
Re:“Swift is the only language I could find with over 100 ke... by philwelch on Sunday August 01, 2021 @04:55PM (#28029877)
It's less useful when you realize that almost every other widely used programming language is better than JavaScript.
Re:“Swift is the only language I could find with over 100 ke... by wdb on Friday July 30, 2021 @02:55PM (#28011097)
Yeah, the design by committee approach of Swift isn't helping either. There are some weird language decisions being made
Re:“Swift is the only language I could find with over 100 ke... by Zababa on Friday July 30, 2021 @08:55PM (#28014204)
56 keywords in OCaml, 99 total if you count the character sequences. Maybe a better metric would be "keywords uses regularly"?. https://ocaml.org/manual/lex.html#sss:keywords
Re:“Swift is the only language I could find with over 100 ke... by xq3000 on Saturday July 31, 2021 @03:02AM (#28016010)
Smalltalk80 wins with only 6 keywords https://en.wikipedia.org/wiki/Smalltalk
Re:“Swift is the only language I could find with over 100 ke... by mmphosis on Friday July 30, 2021 @02:31PM (#28010844)
Re:“Swift is the only language I could find with over 100 ke... by cweill on Saturday July 31, 2021 @12:33AM (#28015330)
I don't see golang on that chart. It must be close to C (on the lower end).
Re:“Swift is the only language I could find with over 100 ke... by ksaj on Friday July 30, 2021 @04:35PM (#28012055)
I'm pretty sure Common Lisp has well over 100 keywords.
Re:“Swift is the only language I could find with over 100 ke... by kevincox on Friday July 30, 2021 @05:41PM (#28012717)
Can you give some examples? IIUC there are builtins (macros/functions that couldn't be expressed in the language) but no keywords. There are lots of syntax elements that could be keywords like ' (quoting) but I am not aware of any true keywords.
Re:“Swift is the only language I could find with over 100 ke... by xedrac on Friday July 30, 2021 @08:33PM (#28014072)
All special forms (if, let, progv, etc...) are very similar to keywords in other languages. But there's only a couple dozen of them.

From Wikipedia: "Some Lisp control structures are special operators, equivalent to other languages' syntactic keywords."

Re:“Swift is the only language I could find with over 100 ke... by kevincox on Friday July 30, 2021 @10:00PM (#28014545)
Personally I don't think that really counts. IIUC you can override those names, so they aren't reserved, and you can implement any one of these as a macro so you don't need to remember anything outside of the core language.

(You can't implement them all as macros, but IIRC there are disjoint built-in sets that can give you the full behaviour)

Re:“Swift is the only language I could find with over 100 ke... by xedrac on Saturday July 31, 2021 @11:08AM (#28018749)
Sure. I think the point he was trying to make is that some languages are more complex than others. And in that context, the fact that Lisp has the flexibility to override just about anything actually makes the language more complex. Because now you can't make any assumptions about anything. In some ways Lisp is the most complex language in existence because it encompasses an infinite number of sub languages (ergo Racket's tagline "The programmable programming language"). In other ways it's the most simple language ever.
Re:“Swift is the only language I could find with over 100 ke... by BooneJS on Friday July 30, 2021 @04:27PM (#28011996)
SystemVerilog (IEEE 1800-2017) has 248.