Swift for codeforces?

Revision en1, by arvindf232, 2020-05-17 11:40:53

Hi! I am relatively new to competitive programming , taken parts in GCJ for 2 years (with Swift). I am certainly new to CodeForces.

I want to use Swift for solving problems on CodeForces, and I am slightly surprised that this isn't an option. If I were to guess, I would say maintaining another language could be costly. But searching through other blogposts (Say https://codeforces.com/blog/entry/72941, https://codeforces.com/blog/entry/52225, https://codeforces.com/blog/entry/67751), it looks like it just wasn't discussed seriously. Also, I couldn't find any general guidelines for suggesting a new language, so it looks like it was just never discussed seriously.

In view of this, I wish to make a feature request about if it is possible to include Swift (Swift 5.1 by Apple) as a language for codeForces.

I will go through some reasons why it is very reasonable to use Swift for CP.

  1. Main Reason: It is a Developed modern language that is decently popular

Swift is a modern language, that has been out since 2014. Basic Object oriented, try/catch features exists. Swift also does a lot of modern features quite well: First class functions, Generics, strong inferred typing.

Swift is consistently within the top 10 most popular language, whichever source I find.

  1. Reason for CP: Very clean syntax

Unlike the the Apple predecessor Objective-C , which is very archaic and clunky in its syntax. The whole Swift is built from ground up keeping clean syntax in mind. Clean syntax is one of the promise of the Swift language. A few things that worth mentioning:

No ; , () , and "return" whenever unambiguous Inferred typing, but still type safe The syntactic sugar of optionals (? and ! operators, guard statement in Swift) Many shorthands for closures (Pure functions in some languages): Any of these can be used for sorting: {a,b in return a<b},{return $0 < $1} , {$0 < $1} ,<.

And some very versatile features that is helpful for large projects, but are conceivable to develop a CP framework out of: Generics, and Protocol with associated types And latest features in Swift 5: Functional builder and property wrappers

Certainly some of these features will be present in some other languages. I don't know about all languages, I am only certain these are not in Python, for example.

The point is not that all these can be reasonably applied in CP, rather, that this set of tools is adapted to some CP tasks, so this option should exist.

  1. The language isn't slow, it is still a statically typed compiled language after all.

  2. Also , not a good reason by itself but still worth mentioning: Google Code Jam has Swift as an option.

I will admit, I like using Swift because I come from industry programming, and a large portion of popularity is due to it being the native language for Apple developments. However, I firmly believe that as explained above, it is a very serious language that is competitively viable.

Therefore, I wholeheartedly wish that I can use Swift for CodeForces. I hope there is a serious consideration on this part.

Tags swift

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English arvindf232 2020-05-17 11:45:14 239 (published)
en1 English arvindf232 2020-05-17 11:40:53 3146 Initial revision (saved to drafts)