RubyFlow The Ruby and Rails community linklog

swift-ruby: bringing the syntax sugar and features from Apple Swift to Ruby

“swift-ruby” is designed to bring over some good features from Apple’s new Swift language to Ruby:

https://github.com/galori/swift-ruby

I implemented only one thing, the ? Optional method operator..please jump in and submit some Pull Requests!

Background:

I just came from Apple’s WWDC and watched their introduction of the new Apple Swift programming language.

From Chris Lattner, a Swift developer at Apple personal site: “Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.”

The ? Optional operator is equivalent to ActiveSupport’s “try”:

The active support version would look like this:

e = Employee.new e.try(:transfer)

The Swift-Ruby version:

e = Employee.new e.transfer?

So, clone the repo: https://github.com/galori/swift-ruby, see Apple’s reference: https://developer.apple.com/swift/, and submit some PR’s.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in