Live data from Hacker News

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

twitter.com

11–20 of 26 posts

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

#12

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…

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 keywords”

#14
post #11

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

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 keywords”

#15
post #11

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

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.

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 keywords”

#18
post #15

Earlier quoted context omitted.

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.

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

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 keywords”

#20
post #5

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.

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

And used by many, so useful to compare to?
Post reply on HN