by mattsears on 6/13/14, 2:54 PM with 40 comments
by Argorak on 6/13/14, 3:25 PM
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.by heydenberk on 6/13/14, 4:08 PM
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)
}
by angersock on 6/13/14, 3:39 PM
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?
by mcosta on 6/13/14, 4:23 PM
Disclaimer: I have walked the tutorial and reference and I belive it is fantastic. I am waiting for someone to release a linux compiler.
by asolove on 6/13/14, 3:31 PM
by Karunamon on 6/13/14, 3:55 PM
The 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.
by galfarragem on 6/13/14, 3:54 PM
Edit/Disclaimer: My first contact with programming (besides BASIC) was Autolisp (Autocad scripting) and my professional field is design.