Why Rubyist Will Love Swift
littlelines.com
Why Rubyist Will Love Swift
1–10 of 42 posts
Re: Why Rubyist Will Love Swift
#2 class Foo
include Virtus.model
attribute :foo, String
end
Now, I could go on like this, but that would be moot. I just question the basic premise of saying that just because 5 features match somewhat nicely (even if it involves more braces of different kinds), those would be reasons for Rubyists to love Swift. Much in contrast, similarity might not be the most compelling reason to switch to something different.Re: Why Rubyist Will Love Swift
#3Re: Why Rubyist Will Love Swift
#4 if current_user = find_current_user
notify_user(current_user)
end
Funny to see an anti-pattern in C/C++ so lauded in another community.Also, you know what I like about Ruby? I can write it and it'll run everywhere, and it is maintained by a vibrant community effort. Where's that on this list?
Re: Why Rubyist Will Love Swift
#5if current_user = find_current_user notify_user(current_user) end Funny to see an anti-pattern in C/C++ so lauded in another community. Also, you know what I like about Ruby? I can write it and it'll run everywhere, and it is maintained by a vibrant community effort. Where's that on this list?
Give the vibrant community effort some time.
Re: Why Rubyist Will Love Swift
#6Edit/Disclaimer: My first contact with programming (besides BASIC) was Autolisp (Autocad scripting) and my professional field is design.
Re: Why Rubyist Will Love Swift
#7The error messages you get when you've done something wrong are unintuitive at best and downright misleading at worst.
Example: I've got a field I want to render an image in. It's represented as an object of type NSImageCell.
I've got my image file defined as an object of type NSImage. So far, so good.
I type the . after the image cell, and I'm presented with a number of autocomplete suggestions. One of which is a method called "setValue" which accepts an object as an argument.
Okay cool.
myCell.setValue(NSImage(named: "myImage"))
Compile and.. instacrash with "Unrecognized selector"What?
Some research turns up that this error means you've tried to send a message to (call a method on) something that doesn't accept that type of message.
Turns out that the method I needed is called setObjectValue. And it also accepts an object as an argument.
So, Xcode. Why did you give me setValue as an autocomplete when it isn't valid on that object? Why are these method names nearly identical? facepalm
And that's before I get into the almost completely worthless inline error messages. "Cannot convert to $T1". What?
I really, really like the language, but Xcode is trying its damndest to turn me away. I've got a stack of bugs/feature requests that need to be entered into Apple's reporting tool - hopefully some of these are just warts that'll get fixed as Xcode 6 comes out of beta.
Re: Why Rubyist Will Love Swift
#8The comparisons with scala and c++ are stronger. This is a large language, with a lot of complexity from having to maintain compatibility with an existing environment, plus lots of new concepts bolted on top. Like those languages, the time to basic proficiency may be faster than with their predecessors, but the time to mastery will be much longer.
Re: Why Rubyist Will Love Swift
#9 if (hasAccess = true) {
doSomething();
}
you meant to compare, not assign. So when I saw this Ruby example, I was not amused: if current_user = find_current_user
notify_user(current_user)
end
However, the Swift equivalent is the best of both worlds: if let currentUser = findCurrentUser() {
notifyUser(currentUser)
}Re: Why Rubyist Will Love Swift
#10if current_user = find_current_user notify_user(current_user) end Funny to see an anti-pattern in C/C++ so lauded in another community. Also, you know what I like about Ruby? I can write it and it'll run everywhere, and it is maintained by a vibrant community effort. Where's that on this list?
You realise that you're talking about a prerelease, right? The language hasn't even been available to developers for a month yet, let alone the general public. Give the vibrant community effort some time.