|
|
|
|
|
by choxi
2460 days ago
|
|
Swift feels like a Frankenstein language though, there are so many keywords and new ones get added in every update. This article here [1] stack ranked a few languages by number of keywords and Swift is #4 on the list. And in Swift 2.1 they added some more, like properties wrappers and the `some` keyword. It gets hard to keep track of them all and the special behavior each one implies. On the other hand, you can kind of make your own language within Swift because most of the keywords aren't required but allow some additive features. For example, some features help you write your code functionally and others support a declaritive style. It reminds me of what's going on with Babel and JavaScript, where babel extensions are like these language plugins you can mix and match to create your own language. If you think of metaprogramming as a way to build your own language within a language, lisps and Ruby were kind of like pioneers of a build-your-own-language trend. I could see that as an interesting direction, I wonder if people have tried it before. [1] https://medium.com/the-traveled-ios-developers-guide/swift-k... |
|
> you can kind of make your own language within Swift
This is one of my favorite aspects of working with Swift. Because it's a relatively un-opinionated language with a diverse toolkit, and because of the powerful type/protocol system, it can really feel like you can carve out a DSL for each specific use-case.