top | item 28009609

“Swift is the only language I could find with over 100 keywords”

29 points| alexobenauer | 4 years ago |twitter.com

24 comments

order

blacktriangle|4 years ago

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.

Gibbon1|4 years ago

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.

vb6sp6|4 years ago

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.

hpen|4 years ago

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.

philwelch|4 years ago

JS is a fairly low bar to compare other programming languages to.

wdb|4 years ago

Yeah, the design by committee approach of Swift isn't helping either. There are some weird language decisions being made

cweill|4 years ago

I don't see golang on that chart. It must be close to C (on the lower end).

ksaj|4 years ago

I'm pretty sure Common Lisp has well over 100 keywords.

kevincox|4 years ago

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.

BooneJS|4 years ago

SystemVerilog (IEEE 1800-2017) has 248.