When comparing Swift vs Earl Grey, the Slant community recommends Earl Grey for most people. In the question“What are the best languages that compile to JavaScript? ” Earl Grey is ranked 29th while Swift is ranked 46th. The most important reason people chose Earl Grey is:
Earl Grey's macro system allows for creating powerful control structures that look just like builtin ones. EG also supports macro libraries which allows developers to provide their macros/DSLs for others to use.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Modern syntax
Pro Swift is closer to other platforms
Apple’s modern programming language is easier to understand for non-iOS developers and minimizes time for additional explanations and clarifications. Moreover, Swift can be used as a script language. It is an interesting solution for the iOS community to unify writing of build scripts. At the time being iOS developers are split up in regard to this activity. Some of them write build scripts in Bash, others use Ruby, Python, etc. Swift gives an amazing opportunity to be applied to all iOS programming needs.
More details can be found here https://mlsdev.com/blog/51-7-advantages-of-using-swift-over-objective-c
Pro Works with Apple's Cocoa and Cocoa Touch frameworks
Pro Can be used as a Just-In-Time language
Pro Inherent parallelism
Pro Low memory footprint due to reference counting
Pro Backed by Apple
Pro Performance speed comparable to native C
Pro Swift has some clever tricks up its sleeve
Due to having elements of a functional programming language. Things like 'map' and 'filter' for example.
Pro Uses LLVM compiler and Obj-C runtime allowing C, Objective-C, Objective-C++ and Swift code to run side by side within a single program
Pro Powerful hygienic macros
Earl Grey's macro system allows for creating powerful control structures that look just like builtin ones. EG also supports macro libraries which allows developers to provide their macros/DSLs for others to use.
Pro Pattern matching
Pattern matching is an incredibly powerful tool that, once you've tried, you cannot live without. This is not your average hacked-together pattern matching but a complete and integral feature to the language.
Pro ECMAScript 6 Asynchrony
Earl Grey provides Promises based on ECMAScript version 6 and as many NPM libraries already implement. Earl Grey also provides a promisify
function that converts old-fashioned callback-style asynchrony to promises.
Pro Fully compatible with Node.js ecosystem
Anything available on NPM can be used just as easily with Earl Grey. In fact, everything else can be used too! Earl Grey has interfaces to Browserify, Webpack, and even experimental support for SystemJS. Earl Grey can even be used to generate npm packages that any node-compatible language can use!
Cons
Con Swift is a moving target
They've released 1.2 so far, and 2.0 is coming soon. Every small update brings adjustments to paradigms (such as how to do type casting) that can be a little frustrating to absorb. Objective C was also constantly updating, however, but not at the same rate these days.
Con Not true static typing
EG gives you the tools to implement your own type-checking inside of argument lists and elsewhere but there's no analysis done at compile-time like other compile-to-js languages.
Con Unfamiliar syntax
While the language shares a lot of DNA with Python, there are still many new (and interesting) features/sugar that may take some time to get used to.