Apple Announces New Programming Language Called Swift
jmcbain (1233044) writes "At WWDC 2014 today, Apple announced Swift, a new programming language. According to a report by Ars Technica: 'Swift seems to get rid of Objective C's reliance on defined pointers; instead, the compiler infers the variable type, just as many scripting languages do. ... The new language will rely on the automatic reference counting that Apple introduced to replace its garbage-collected version of Objective C. It will also be able to leverage the compiler technologies developed in LLVM for current development, such as autovectorization. ... Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup of about 1.3X compared to the same code implemented in Objective C.'"
Language basics, and a few worthwhile comments on LtU.
AAPL's YAPL
Good bye source compatibility. We hardly knew ye.
First Windows, and now OSX. I am still maintaining applications that are built crossplatform (Windows/Mac/Linux, with unified GUI look) but it's getting harder every year and, by the looks of it, will be impossible soon.
Which means that an individual developer (like myself) or a smaller shop would have to choose one big player/OS vendor and stick with it. That increases risk and makes small players that much less viable (while, of course, helping the big ones consolidate user base and profit).
Funny how the world works.
That's what about 1/10,000th of what hiring a good programmer would get you, at the price of not being to find any programmers.
I was particularly surprised to see closures appear. So far I've only been using them in Javascript and Perl, but my experience has been that they are about 15% added flexibility for about -40% readability. That is, they make it harder to tell what's going on, more than they reduce development time.
Just the other day I was wondering when we'd have another programming language.
The live REPL reminds me of Bret Victor, who used to work for apple.
http://worrydream.com/Apple/
I hope they take advantage of some of his ideas?
https://www.youtube.com/watch?...
"Immutability has a slightly different meaning for arrays, however. You are still not allowed to perform any action that has the potential to change the size of an immutable array, but you are allowed to set a new value for an existing index in the array. This enables Swift’s Array type to provide optimal performance for array operations when the size of an array is fixed."
i.e. Swift arrays that are "immutable" actually aren't. Way to rewrite the dictionary. But wait, it gets worse. Here's for some schizophrenia.
"Structures and Enumerations Are Value Types. A value type is a type that is copied when it is assigned to a variable or constant, or when it is passed to a function. Swift’s Array and Dictionary types are implemented as structures."
So far so good. I always liked collections that don't pretend to be any more than an aggregate of values, and copy semantics is a good thing in that context (so long as you still provide a way to share a single instance). But wait, it's all lies:
"If you assign an Array instance to a constant or variable, or pass an Array instance as an argument to a function or method call, the contents of the array are not copied at the point that the assignment or call takes place. Instead, both arrays share the same sequence of element values. When you modify an element value through one array, the result is observable through the other. For arrays, copying only takes place when you perform an action that has the potential to modify the length of the array. This includes appending, inserting, or removing items, or using a ranged subscript to replace a range of items in the array"
Swift, a language that is naturally designed to let you shoot your foot in the most elegant way possible, courtesy of Apple.
Just what we need! Better compilers is what we really need, but that apparently is too difficult.
Must have 5 years experience.
and the comment grammar no sense slashdot article read.
captcha: verbally. Seriously?
They could have chosen a name other than that of the international banking protocols. Asking for SWIFT programmers is going to get them a bevy of COBOL coders who know the protocol.
I do not fail; I succeed at finding out what does not work.
I find these two aspects interesting and wonder what the trade off is. Longer compiler times?
"Designed for Safety
Swift eliminates entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically. Syntax is tuned to make it easy to define your intent — for example, simple three-character keywords define a variable (var) or constant (let)."
" Swift code is transformed into optimized native code, "
It took you 3 minutes to type THAT badly?
10 years professional development experience preferable.
Many sites are reporting Swift as having "none of the baggage of C."
However, they also report that "Swift code can still be mixed with standard C and Objective C code in the same project."
Seems to me that if you can call C routines, C can happily malloc() and free() the heap and leave stale pointers into freed heap. Likewise, C can happily point into the stack and leave pointers into stale stack frames, and point past the end of arrays, etc.. I don't think they can get rid of the "baggage of C" withoud building all kinds of performance killiing safety checks into the C code. If I'm wrong about this, please don't hesitate to let me know!
--- Often in error; never in doubt!
It's supplementing the existing Obj-C and C API's, not replacing them.
I would imagine already existing code will continue to function just fine.
Yeah, I agree. What he said.
*that poorly.
You know how high level language advocates like to claim that being high level means it can actually be optimized better than a low level language since the compiler knows what you're doing? And you know how it's never actually true? It finally happened.
I mean, there is already a swift programming language. Yes, it is not popular, but when you decide on a name for your language don't you at least google it first? Is "swift" so unbelievably cool that a name collision (even with a "small" entity) does not matter? But, yeah, it is Apple we are talking about, they probably invented the word "swift" which people and companies like SUZUKI have been copying for other uses here and there...
Violence is the last refuge of the incompetent. Polar Scope Align for iOS
...with "5 years experience Swift programming" coming from the recruiters in 3, 2, 1...
I wanted to write apps and tried to learn Objective-C, but as a coder that started with C and then moved on to C++ and PERL (the swiss army chainsaw), the language syntax hurt my ability to read it. In case you don't know what I am talking about, here are some of my learning notes
// old school // send a message or call a method
myObject.someMethod();
[myObject someMethod];
result = myObject.someMethod(); // old school // method returns a result
result = [myObject someMethod];
result = myObject.someMethod(arg); // old school // pass an argument
result = [myObject someMethod:arg];
You can see the Old School syntax above (which works in Objective-C) and the Objective-C standard syntax below. The square brackets [ ] and colons : just hurt my mental debugger... [ ] and yes I know Objective-C is a Superset of C, so they had to steer clear of the C-Syntax but it just looks wrong. Further, I know that I could write my own style of Objective-C but I wouldn't be able to read the code of others. Apple had to start somewhere and Steve had the NeXT languages ready to go but to me the syntax is ugly and offensive. However, I am ready for a better Apple language.
I can't wait to see a SWIFT code example, if it gets rid of the NeXT Objective-C Superset Syntax, I might be coding for iPad and Mac sooner than I thought. If anyone has a code example, please share it, I would like to see what a function, method, or message call looks like. Hoping for parenthesis and a Standford iTunesU class. Guardedly excited!
Just kids re-inventing the wheel again.
I'm sure everyone was thinking, we don't have enough languages that are basically a badly implemented subset of C++. We need to make another one.
Let's see if Android will respond by creating an even less compatible C++ clone than Java.
Apple is the king of vertical integration and proprietary standards. The only thing that surprises me is that it took them this long. MS beat them with C# by how many years? Google has two of these things (Go and Dart) AFAIK.
Now I just need to finish my universal cross-compiler that never quite takes advantage of all the features in these languages because it's too damn difficult and they are moving targets.
That's it. We need a language called "Target" that's constantly moving.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
...5 years experience, and you pretty much would have had to have written the language to have that much...
Do you get Swift Boating? http://en.wikipedia.org/wiki/S...
Strange, because immutable arrays are possible and (asymptocically) efficient. Standard ML, the predecesor of OCaml and F#, has it it http://webcache.googleusercontent.com/search?q=cache:7nopWhLOQjwJ:www.standardml.org/Basis/vector.html+&cd=1&hl=en&ct=clnk&gl=nl&client=safari (Google cache as they seem to be moving servers).
Apple had a fine language 20 years ago. It was said to influence the design of Ruby and Python. They butchered it into an Algol-like syntax because 'real programmers' can't grok s-expressions. Then they abandoned Dylan.
Next, they created a language for mobile devices. Its programming model was said influence the design of JavaScript. Then they abandoned NewtonScript.
Score: -1, FUD
It uses objective-c's runtime, Apple's implementation is compatible with iOS 7 and 8, and OS X Mavericks and Yosemite. I'm sure plenty of 3rd party implementations will appear too, much like they have done for obj-c.
My favorite part of immutability is 'let.'
If you write:
let i = 5;
You have just declared 'i' to be immutable. Intuitive, isn't it?
"First they came for the slanderers and i said nothing."
When Steve Jobs announced the iPhone, Cisco owned the trademark to iPhone as I recall. And he didn't care.
Apple has enough $$$ to payoff for virtually any name they set their mind to, just like what they did with the iPhone.
http://www.idownloadblog.com/2012/01/27/apple-cisco-iphone-trademark/
Priest: "Universe from nothing, no laws of physics, sped up time"+ huge discrepancies. Creationism? No. Big Bang Theory
The language doesn't have exceptions.
It has strong emphasis on assertions though, so feel free to use those as a substitute.
"First they came for the slanderers and i said nothing."
There's not really a trade-off. It's just newer. Variable types can be inferred statically using unification (which is fast and actually more expressive than manually typed languages). Standard ML has done it for many years.
Same with forcibly initialized values. Means you don't need to check pointers ever. Basically the same as references in C++.
Bounds checking is rarely needed. Again, I point to Standard ML; here, instead pattern matching and higher order functions are used. This is basically what Swift does with closures and the map operation. If you look at the fold operations of all Standard ML types (that's basically the inspiration for the map-reduce paradigm), it is obvious that no bounds-checking is necessary, and iterating over an entire structure is almost always what you do with a data-structure (aside from initialization), and the only operation where you access the structure many times and would have an overhead for bounds-checking.
Memory seems to be managed using ref-counting, which is similar to auto_ptr in C++. Barely any overhead (a zero-check on deallocation, which can even be biased towards branch-predicting that no deallocation needs to take place).
I knew that Swift was trouble when it walked in, trouble trouble trouble
"First they came for the slanderers and i said nothing."
Apple definitely needed to do something because Objective-C was really getting long in the tooth. As far as new languages go, at first glance, this looks nicer than what the other players have to offer (Java, C#, Go).
However, proprietary languages don't tend to fare particularly well. If this gets an open source implementation and isn't patent encumbered, however, it might also be a good thing for Linux.
Maya , modo .. Google these apps
For Apple, then once for everybody else! Too much time on my hands! Said Tommy Shaw!
There is VLC
There is CMake
There is my project -- https://sourceforge.net/projec...
There is Sorenson Squeeze -- http://www.sorensonmedia.com/s...
I am sure there are others
No this is NOT a troll, please read.
A claim of cross-platform is one thing. But in practice I know of no significant apps using Qt that exist in the wild that work on OS X.
Please provide a link to any mainstream working application for Mac OS X that uses Qt.
I don't know of a single one because Qt's support for XCode is incredibly poor.
Do you have to use Xcode, the IDE, to develop OS X apps? Or by "Xcode" do you mean "Xcode the IDE, plus the command-line tools"?
"I can code faster than ever!" Tom said swiftly.
Too soon?
Oliver's law of assumed responsibility: If you're seen fixing it, you will be blamed for breaking it.
> the compiler infers the variable type, just as many scripting languages do
Someone doesn't seem to understand the difference between dynamic typing (which is what "scripting" languages use) and static typing with type inference (which is what Swift uses).
Then compile your code with Eclipse or from the command line.
What has XCode to do with developing Qt?
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
requiring 5 years of experience with Swift on iOS?
My god, it's like I'm at Stack Overflow, reading the typical stupid and cocky "WHY ARE YOU DOING IT THAT WAY?!?#?!?@?!@?!?" responses that are so prevalent over there.
His team probably has its reasons for using or requiring GDB. And you know what? They're probably pretty damn legitimate reasons, too.
I'm sure they know about LLDB. But it's probably not what they need, and thus they do not use it.
If they need GDB, then that's what they need. It's that simple.
What we don't need is somebody like you questioning the validity of their very real need.
I haven't yet decided whether this is yet another programming language we needed, but I will be interested to see whether Apple release the Swift support in LLVM as open source. One thing that I dislike more than new programming language for the sake of doing so, are single-platform languages.
Jumpstart the tartan drive.
I'm a developer at MakerBot. Our entire UI is built in Qt specifically for cross platform capabilities. It runs on OSX just fine.
It's Scala. They left out pattern matching and didn't drive the monadic nature of common programming collections through the collection classes. You can leave out the monads (although the first time you want to convert the contents of an Optional value via a function returning an Option you'll wish they hadn't) but leaving out pattern matching was a plain and simple misstep.
Not really, there's also Dart, an actually forward-looking systems language with a lot of real thought behind it. But nobody pays attention to that, because it's not by Apple or Google. Far better to keep favoring whatever Google's current ga-ga for, or Apple's latest pre-alpha press release of a language.
"Funny how the world works."
No it isn't. You're probably one of the very people that was against the proliferation of Java, or cross platform generally. What did you think was going to happen? C would be cross platform?? Get real..
Nuke and a lot of other software used for computer graphics.
I'm sure they know about LLDB. But it's probably not what they need, and thus they do not use it.
Whatever they NEED gdb for, they would be better off using LLDB at this point.
I was a huge fan of GDB in the past. But that time has gone.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Tarzan? Is that you? Totally unintelligible gibberish...derka derka.
It doesn't use Metro's libraries.
Anything that doesn't use the Windows Runtime API (what you call "Metro's libraries") will not be approved for the Windows Store and will not run on Windows RT tablets or Windows Phone 8 smartphones.
Looks like a decent language, actually.
I was under impression that all new windows "apps" had to be written in C# against a new SDK that has neither binary nor source compatibility with Win32/posix/C/C++. I'd be glad to be wrong, but that's what I've seen so far.
Only Windows Phone 7 and Xbox Live Indie Games required C#.* C++ works on Windows Phone 8 and Windows RT, though they do require use of the Windows Runtime API. For actual Windows on x86, you can continue developing desktop applications without having to deal with Windows Runtime (the "Metro" crap).
* In theory, they required verifiably type-safe CIL compatible with the .NET Compact Framework. In practice, they required C#, as standard C++ is not verifiably type-safe, and DLR languages require functionality not in .NET CF.
Good bye source compatibility. We hardly knew ye.
I have absolutely no compatibility problems. I strictly use objective-c for only user interface code. The core functional application code is written in c/c++. I have multiple iOS/Android apps whose core code is shared and can even be compiled with a console app under Mac OS X or Linux, I use this for regression testing and fuzzing. A headless Linux box in the closet exercises this core code. Similar story for Mac OS X and Windows.
Swift code can replace objective-c code and it matters little to me. Has zero impact on other platforms I target.
Admittedly I've ported other people's code between Windows, Mac and Linux for years and written my own code for Windows, Mac and Linux for years and as a result I am extremely aggressive about separating UI code from functional code.
For those people using some sort of cross-platform wrapper for their project, if it supports Mac OS X objective-c it will probably support Swift. Even if it takes time for the wrapper developers so what, the use of Swift is entirely optional.
Apparently your "team" is too stupid to install GDB and too incompetent to write a string to select a font.
Autodesk Maya
I'm NOT going to ditch 30-years of code base just for one FABRICATED DEMO !
Fuck Apple.
PS
Good for Apple that I am not piloting a B-52H with a Mk-41 just to dig a hole where the Apple
campus in Cupertino now exists.
Bye bye Cupertino and Apple.
Happy zombie day
Ha ha
There is this little program called "Google Earth". Its Qt and on the Mac. I guess it was a troll.
Ok, so now you'll be developing software using Apple's frameworks and Apple's language to run on Apple's runtime, after passing Apple's compiler (i.e. LLVM) for download using Apple's store (after finding your product with Apple's iAD) directly onto Apple's products built with Apple's custom processors, after you register as an Apple Developer. If your app needs to do something outside this environment, you can use said APIs now to reach out to Apple's Could and Apple's Database servers. And if your app is really successful as measured by Apple Crash Reporting and Apple Usage statistics or Apple's iTunes Connect, then they'll just straight out fucking copy you.
Something about the new "language" is what makes that summary start sounding ridiculous.
-- I was raised on the command line, bitch
Qt has its own cross platform IDE. It uses the Xcode command line tools behind the scenes. It has very good Qt support.
and you pretty much would have had to have written the language to have that much
Exactly. It sounds like someone who constructs such a job posting is looking to poach the language's designer.
Wireshark is currently rewriting their UI in Qt explicitly because it provides a much better OSX interface than the existing version.
https://blog.wireshark.org/2013/10/switching-to-qt/
In the Obj-C case, it's obvious, the parameter names are part of the name of the function
Such a convention can also be done in C++: someObject->setColorRGBA(0.4,0.3,1.0,0.5);
Or in JavaScript: document.getElementById('main') and element.appendChild(another)
Dart is a Javascript replacement and is by Google. Maybe you meant Rust or something else?
Dang right. I imagined connections to the famous satirist behind A Modest Proposal and Travels into Several Remote Nations. Is this a satire, or is it the real thing?
They are switching from GTK+ to QT. That completely sideways move. There shit user interface will still be a piece of shit.
Bjarne Stroustrup once gave some ideas on what requirement should be met before he would consider designing a new programming language. This was his list:
* What problem would the new language solve?
* Who would it solve problems for?
* What dramatically new could be provided (compared to every existing language)?
* Could the new language be effectively deployed (n a world with many well-supported languages)?
* Would designing a new language simply be a pleasant distraction from the hard work of helping people build better real-world tools and systems?
Apple can definitely deploy the new language effectively, but I'm not sure it solves any problems.
"First they came for the slanderers and i said nothing."
It's like you forgot that Google exists. http://qt.digia.com/Qt-in-Use/
This looks bad:
Swift uses string interpolation to include the name of a constant or variable as a placeholder in a longer string, and to prompt Swift to replace it with the current value of that constant or variable. Wrap the name in parentheses and escape it with a backslash before the opening parenthesis:
// prints "The current value of friendlyWelcome is Bonjour!"
println("The current value of friendlyWelcome is \(friendlyWelcome)")
I hope they locked that feature down to constant strings. What could possibly go wrong with a language feature which lets you access arbitrary variables by name at run time by string interpolation?
(Hey, let's use an email address of "\(SitePrivateEncryptionKey)" and see what happens!)
...their IDE named Taylor.
Do you know of any examples of open source iOS/OS X software that demonstrates this separation of writing the user interface in objective-c and the guts in something different (e.g., c++)? I'm a total objective-c novice, but would be curious to see how it's done.
Anything that doesn't use the Windows Runtime API [...] will not be approved for the Windows Store and will not run on Windows RT
Digia has already done exactly that with Qt. [See "Getting started with WinRT".]
If your application runs on "Qt for WinRT", which in turn runs on Windows Runtime, then for the purposes of the Windows Store, your application runs on Windows Runtime.
http://en.wikipedia.org/wiki/Category:Software_that_uses_Qt
Wasn't a hard search. Adobe Photoshop Album is in there, Google Earth is in there too.
From a more personal experience I helped create the windows port of Scrivener (very popular mac program written in Objective-C). The windows-port work was done in Qt/C++ and I did 90% of my development on a mac. And unless you were familiar with the program you would have a hard time picking which was the objective C version and which was the Qt version when they ran side by side on a mac.
I'm not sure what the problem with XCode support is because I didn't use XCode. I didn't need to. I didn't want to. But then over the last ten years I've worked almost equally over the three major operating systems with a weighting to Linux.
Sandals wow~~~beauty~~
Runs just fine except for the GUI looking like a complete piece of shit.
But it does so equally across all platforms!
#DeleteChrome
There are plenty of apps that use QT--probably the most mainstream one is Google Earth.
Now, look at me with a straight face and say, "And Google Earth has a great UI!"
To me, this is the problem with cross-platform UI. It starts from a mistaken premise: Windows and Mac or iOS and Android have the same basic UI. There's even a grain of truth to it. But it doesn't really work.
The example I love to use is French and English. They are, basically, the same language, right? They both have words, sentences, and paragraphs. They both have nouns, verbs, and adjectives. So if you just translate the words and move around the adjectives, you've got a French/English translator! It's that simple!
No, not really. If it's 100 degrees outside and you've just come from the outside and remark to a pretty girl "Je suis chaud" (literally, I am hot), she might very well slap your face. Because you've just said that you are hot as in, "Oh, baby, you make me so hot."
And those are the silly mistakes that cross-platform UIs make.
Take a simple one from Mac versus Windows: On the Mac, in a dialog box, the default button is always the right-most button. So you have a dialog box that says, "Are you sure you want to do this?" and the right-most button would say, "OK" and the button to the left of it would say, "Cancel." On Windows, the default "OK" button would be on the left with the "Cancel" button the right of it.
Alignment, again, is a question. I'm not sure there's a standard on Windows--I've seen things centered and I've seen them aligned right. On Mac OS X, there's a standard. Which means when Windows aligns them on the right like on the Mac, I'm always pressing the Cancel button.
So, yeah, you can use QT to have a cross platform application and it will work fine. And it's great, if you have an application like Google Earth, which has lots of great GIS capabilities so that the result is worth the pain. But, frankly, if Microsoft did an equivalent to Google Earth but made a Mac application that was "correct," I'd use it in a heartbeat. Because, all else being equal, I'd rather have an application that "speaks my language" to one that only sort of does.
Have you ever spoken to a tech support person from another country with a thick accent? That's the equivalent of using Google Earth on a Mac.
Whatevs, yo. Google Earth is pretty damned mainsteam. If it's not by you metric, then it's your metric that's unscientific.
Whatevs, yo. Google Earth is pretty damned mainsteam. I run it in my browser FFS. If it's not by your metric, then it's your metric that's wrong, not the OP.
Parallels Desktop (virtualization software).
Apple's decision to enforce explicit nullability via the type system is very interesting/bold. http://deanzchen.com/the-best-...
you haven't heard of Google Earth or VLC ?
The Gnome developers are taking care of that.
Please provide a link to any mainstream working application for Mac OS X that uses Qt. I don't know of a single one because Qt's support for XCode is incredibly poor.
Ok, I know for a fact (by having several email volleys with the Developer) that Eagle PCB/Schematic Capture, etc. CAD/CAE suite uses Qt on OS X.
http://www.cadsoftusa.com/
And I'm sure there are some others on this list. In fact, about 1/2 of the Qt-based engineering apps listed at the bottom of the page list OS X as a Target OS:
http://en.wikipedia.org/wiki/C...
And if you want Proprietary software with OS X versions that use Qt, here's a list. I'm sure you'll recognize most of these apps:
http://en.wikipedia.org/wiki/C...
Now, having said all that, Qt is horrible. But not unpopular...
The scientific method is providing proof --- rhetoric and hot air is great, but science is providing evidence
Huh? So which one is it, proof, or evidence? Surely the two of them are not the same. Also, scientific evidence is quantitative and statistical in nature, and you're asking for an anecdote. Please stop pulling the term "scientific" into places it doesn't belong; we're not formulating theories of software here.
Ezekiel 23:20
Apple developped Dylan and later NewtenScript long long before MS had its 'own' language.
Real apps were written in HyperCard. It was VB before VB existed.
Make sure everyone's vote counts: Verified Voting
.. it is swiftly forgotten.
I had to figure out how to increment an NSNumber over the weekend. It's not pretty:
NSNumber *num = [NSNumber numberWithInt:[num intValue] + 1];
Seriously. Unless you're some foofy artiste, nobody gives a shit about Crapple.
Their entire business model has shifted to the assumption that they are the center of all creativity and innovation in the world.
And now they're going to sue everyone for using their creativity and innovation without paying some obscene licensing fee so nobody there has to every actually do anything.
Fuck Apple. I wish someone would nuke Cupertino so I didn't ever have to hear from those turtlenecking douchebags again.
Here is a Mac OS X GUI app with a window and a button implemented in objective-c (main.h, AppDelegate.h and AppDelegate.m). The button handler calls C code (Work.h and Work.c) to do some work. Note that if C++ code had been used then AppDelegate.m would have been renamed to .mm so that Xcode would compile it as Objective-C++, necessary to link properly against the C++ code it uses.
// main.m
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]){
return NSApplicationMain(argc, argv);
}
// AppDelegate.h
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
// AppDelegate.m
#import "AppDelegate.h"
#include "Work.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}
- (IBAction)buttonPressed:(id)sender {
some_work();
}
@end
// Work.h
void some_work(void);
// Work.c
#include <stdio.h>
#include "Work.h"
void some_work(void) {
FILE *fp = fopen("/tmp/work.txt", "w");
if (fp != NULL) {
fprintf(fp, "Hello World\n");
fclose(fp);
}
}
Do you know of any examples of open source iOS/OS X software that demonstrates this separation of writing the user interface in objective-c and the guts in something different (e.g., c++)?
The biggest example would be anything based on OpenCL, where you would do exactly that.
Also a number of games, use a shell of IOS framework stuff for things like game menus and leaderboards, but the actual game engines are C++ (and I'm not even talking about apps that use third party libraries like Unity).
"There is more worth loving than we have strength to love." - Brian Jay Stanley
They've invented FreePascal with a new name and constant definition, 'let' or is that from Basic?
Dear Troll,
You are wrong and you know it, but please continue.
I have created a brand new language too: Common Routine Acceleration Package. It autovectorizes common control structures to that multi-processing can be applied automatically to every program just by compiling it (and it automagically includes all thread libraries). Its just that some people have complained about the name.
I'm personally not impressed with swift... it seems rushed and not well done.
My team has already stopped supporting Mavericks because it apparently does not support GDB.
You can get GDB (and pretty much every other open source dev tool) from https://www.macports.org/
https://stackoverflow.com/ques...
Oh, stop trolling. You have obviously never used Qt, it will automatically fix the order of the dialog buttons for you. You can even launch the same application under GNOME and get one order, and under KDE and get another. It is controlled by the widget-style it uses. And it does more than that, it also matches the reading direction of the language you are using so that it reverses for Hebrew, Arabic or other right-to-left languages.
There are things that you need to handle yourself in a crossplatform application, but that is not one of them.
I've been developing iOS Apps professionally for a while now. There are issues with Objective-C, but the function call syntax is hardly one. I'd actually even consider it a benefit. The messages tend to read like sentences. Each parameter gets a name (they're not quite named parameters, as you cannot refer to them by the 'name' inside the method body).
Consider:
hwnd = CreateWindowEx(WS_EX_LAYERED, TEXT("Hello"), TEXT("World"), WS_OVERLAPPEDWINDOW, 10, 10, 400, 400, NULL, NULL, hInstance, NULL);
vs.
hwnd = [SomeClass createWindowExWithExtentedStyle:WS_EX_LAYERED className:TEXT("Hello") windowName:TEXT("World") style:WS_OVERLAPPEDWINDOW x:10 y:10 width:400 height:400 parent:NULL menu:NULL instance:hInstance param:NULL];
This is a win32 method. And it's a bit of an extreme example. But you should see how the syntax allows for some "self documenting" code. How is this possibly "offensive"? I see code where method And I can't imagine this syntax being a barrier for any one outside of a beginner; any professional should have no problem adapting to this.
Objective-C is a pretty simple addition to C. Far far simpler than C++.
I think you've hit the nail on the head, the promise of developing a UI once and having it just work right everywhere is one that's never been realised.
I think anyone looking for this is probably asking the wrong question when they say "So how do I write a cross platform UI now?".
I think the best solution for the problem is to write your data and logic libraries in a portable manner and, write the UI that consumes them in a platform specific technology. In practice that probably means write your libraries in C++ and then consume them with a platform specific UI technology like say WPF in Windows.
So the real question you should be asking is "Can this new technology interoperate with my existing C++ libraries?". If it can't, then just do not bother supporting that platform. This is something Microsoft learnt the hard way and hence why they started supporting exactly this with Windows Phone 8 - they were coming from a low point in the market anyway so why would anyone waste time developing for Windows when they couldn't even carry their shared iOS/Android libraries across?
The battle is already lost on a technology for good cross platform UI development as it was never practical when we have so many divergent UIs. The battle instead is about making sure code that is platform neutral can be carried between platforms and consumed by platform specific technologies.
https://crypto.stanford.edu/~b...
If Pandora's box is destined to be opened, *I* want to be the one to open it.
... HR departments began advertising for programmers with 3+ years of Swift programming experience.
Swift also makes extensive use of variables whose values cannot be changed. These are known as constants
What am I missing here?
Geology - it's not rocket science; it's rock science
Boy /. Has gone down the toilet ...where's that site some built to replace it?
Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup
Only a couple? You can do that in just about any language. Systemic improvements ... I guess they tried but failed or they would be announcing it.
I think you've hit the nail on the head, the promise of developing a UI once and having it just work right everywhere is one that's never been realised.
All Swing (Java) Applications I worked on are just fine under the targeted platforms (Mac Os X, Linux, Windows).
Regarding Qt my experience is limited but IMHO the demand for "exact" platform look and feel is overrated.
Considering that Windows 7 versus Windows 8 is a considerable change as well as Mac Os X 10.8 versus 10.9 is.
Bottom line I really wonder "who cares"? I never met one who actually cared.
"Can this new technology ..." ... then just do not bother supporting that platform It is neither a new technology nor a new platform: it is a simple programming language. Targeted for iOS and Mac OS X and you can bet an iOS App written with that language wont run on Mac OS X and vice verse.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Oh, stop trolling. You have obviously never used Qt, it will automatically fix the order of the dialog buttons for you.
It will do that if you use QDialogButtonBox with buttons from the StandardButton enum, but if you just drag a few QPushButtons on your form in Qt Designer it won't so it does depend on the application developer doing cross-platform right.
Live today, because you never know what tomorrow brings
Every corporation has their own language for their walled garden environment now. What happened to industry standards and portability of skills?
There's nothing mysterious about it. The Apple compiler I think even lets you mix C++ and Objective-C in the one source file. You just write your business logic in C or C++ and call it from your gui code in objective-C. As long as your business logic is easily callable from a C interface, it isn't hard. Of course, mixing languages is always painful to some extent.
http://lmgtfy.com/?q=VLC
The problem with those apps is that they have their own interfaces. They don't look or behave like native applications.
Don't this code have the problem that you call some_work from the gui thread, and thus will block all updates of the graphics userinterface while some_work is running?
That problem can be solved, but it is always things such as long running tasks, and async callbacks which causes problems. Especially if you need to populate the gui with the work from some_work, while some_work is still doing its work.
"All Swing (Java) Applications I worked on are just fine under the targeted platforms (Mac Os X, Linux, Windows)."
To you yes, but for the end user it's a different story. They like the familiarity of their standard UI elements and Swing doesn't offer that.
"Bottom line I really wonder "who cares"? I never met one who actually cared."
Lots of people, if you have interaction with end users you'll see it, it's prolific. Many of them are horrified by even slight differences from the norm let alone when differences result in requirement of slightly different usage patterns.
If you're doing internal work you can normally get away with slightly crap UIs (though even there it'll raise eyelids), but if you're selling a product it's just tacky to give someone a half-arsed UI because you couldn't be bothered to make something that fits the platform. It's what makes your software lose out against the competition.
"It is neither a new technology nor a new platform: it is a simple programming language. Targeted for iOS and Mac OS X and you can bet an iOS App written with that language wont run on Mac OS X and vice verse."
A programming language is a technology so it doesn't make sense to say it's a new programming language but not a new technology, and how are iOS and MacOS X not platforms? I didn't say they were new. I just made the point that if a platform decides to go down the route of rejecting portability of all your code (as Windows Phone 7 did) then just don't waste your time with it. Focus on platforms where you can carry across the bulk of the code that makes up most applications that tends to be platform agnostic, they'll soon change their way to cater to portability of at least some of your code, just like Microsoft had to with Windows Phone 8.
Isn't auto-vectorization done in the back-end of LLVM anyway? So it shouldn't matter which programming language was used in the front end.
"We mustn't be caught by surprise by our own advancing technology" -- Aldous Huxley
You can still use all the same languages you did before.
Yeah! We can program in standard C++ on the iPhone like we've always been able to do!
Look, almost all software is an interface between a human and a machine. When you arrogantly decide to ignore half of your implicit interface, your software is going to suck. My project became wildly successful when I pissed off all of my programmers by promoting the human factors guy to management; all of the sudden we had usable software instead of "my module is sexier than yours" competitions that ignored the end product.
The tools and compiler for developing in this language will be available for OSX 10.10 only.
Please provide a link to any mainstream working application for Mac OS X that uses Qt. I don't know of a single one because Qt's support for XCode is incredibly poor.
calibre. Extremely popular in the ebook community. And I have never used the language, but I imagine that you're correct about the issues. Qt on MacOS must be a real PITA, because I've had to submit bug reports for problems that I could have avoided using just Applescript.
But I'm glad it finally did. And I love the way it feels very javascripty! :)
But, frankly, if Microsoft did an equivalent to Google Earth but made a Mac application that was "correct," I'd use it in a heartbeat.
Maps, from Apple.
Seriously, though, this discussion was about PC operating systems.
Yet Microsoft is trying to confuse the public by calling Windows RT devices "PCs". (Source)
Avid Media composer.... I know this, because I wrote parts of it myself, in QT.
"In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson
To you yes, but for the end user it's a different story. They like the familiarity of their standard UI elements and Swing doesn't offer that.
HÃ? Why should swing not offer that? Ofc it does, that's the point of it.
Focus on platforms where you can carry across the bulk of the code that makes up most applications that tends to be platform agnostic That is impossible in the iOS versus OS X case anyway so even more my point: Swift isa new language and not a platform.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
No, not really. If it's 100 degrees outside and you've just come from the outside and remark to a pretty girl "Je suis chaud" (literally, I am hot), she might very well slap your face. Because you've just said that you are hot as in, "Oh, baby, you make me so hot."
not to nitpick but in french you say "J'ai chaud" which translates to "I'm warm". If you say "Je suis chaud" in Quebec it translates to "I'm drunk"! :-)
Name's taken apple try harder or are you just going to go around suing everyone who used it before you.
You are right, but the question is, where do you deal with that threading.... in some cases you would want it dealt with in work.c because you want it to be multi threaded on all platforms... if a task called is going to take a long time and block the UI on one platform it will do it on another.
Alternatively you could make that decision in the UI code but that would mean handling it on every platform.... now on the mac its pretty easy in Obj-C to dispatch a task to a thread, its probably easier than in C++ so maybe that makes it easiest to handle but then you have to turn around and do the same thing on every other platform you wish to support. I think that if you are supporting multiple platforms you would want your threading code to be in the shared code.... but its a design decision and it really does depend on your project and your needs.
"In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson
"HÃf? Why should swing not offer that? Ofc it does, that's the point of it."
No it doesn't. It tries, but some of the components are quite different to their standard counterparts. Maybe you're getting confused with SWT?
"That is impossible in the iOS versus OS X case anyway so even more my point: Swift isa new language and not a platform."
Incorrect. Both platforms support C++. You can easily write C++ code that's platform agnostic and compiles on either platform.
Your home page says you're an OO mentor, how can you mentor in OO and not grasp the basic concepts of code separation and reusable code?
And yes, I know Swift is a new language and not a platform, are you having a discussion with yourself or something as I didn't say otherwise. I said iOS and MacOS are platforms, I said Swift is a technology. A new one.
I sure hope the creators of http://www.swift-lang.org/ have got the trademark/IP. If not, they'd better prepare for an incoming lawsuit.
I'm glad the industry is run by people trying to advance programming languages and tools otherwise I would be writing my programs by punching cards.
It's already much faster and easier to deploy quality apps on IOS than Android, It looks like is going to get even easier and faster with this new language.
Yeah, I'll wait for 10.10 for that. OS X 10.9 is way too flaky.
Also, Maps doesn't have nearly the features of Google Earth.
I love the "no true scotsman" argument. It's so useful.
This was always the joke in 7th grade French class, saying "Je suis chaud" instead of "J'ai chaud." That's what I meant when I said "literally", as "Je" is "I", "suis" is "am", and "chaud" is "hot." So if you just translate the words, you get the wrong answer. "J'ai Faim" (I am hungry) has a similar issue,
As for the Quebecois, well... :^D
Incorrect. Both platforms support C++. You can easily write C++ code that's platform agnostic and compiles on either platform.
We are talking about UIs, not code for the data model. Hence the term "platform". For non UI C++/Swift code the question of the platform is of nearly no concern (except the size of int etc.)
And your terminology is wrong again, swift is not a technology, it is a programming language.
No I'm not mixing Swing with SWT. I doubt you can point out any Swing failure on any supported platform, perhaps you could ten years ago. SWT isa rguable meanwhile not anymore aiming for true platform conform look and feel. Basicaly where every you see a SWT application you imediatly notice: oh this is a SWT application.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Please provide a link to any mainstream working application for Mac OS X that uses Qt. I don't know of a single one because Qt's support for XCode is incredibly poor.
Second Life. They still make regular releases for the Mac (and Linux). It's open source, so you can grab a copy and see how they do it. Xcode not required.
I can assure you that every time I see a Swing application, I do immediately know that it's a Swing application - and that is on Windows. For one thing, its file selectors are clearly non-native (and otherwise very limited in functionality). Menus aren't quite rendered right. Textboxes don't have the right context menu. Etc... there's lot of small details like that which together make it look exactly like what it is - not native, but trying.
Yes, you told that often enough :)
However to manage to display a non native filesecltion box the programmer already has to do extra work.
If you simply use a standard file save dialog and a standard file open one, the system file selection box pops up. No idea how programmers mess this up so often.
Never saw anything wrong with menus, you must have sharp eyes and be knowing to look for such flaws.
I have a Swing App on Windows 8 in front of me, and I see no single difference to to other Windows Applications (except that Outlook does look alien, but so does Chrome)
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Have gnu, will travel.
Perhaps you should read the answers to your post first before making an idiot out of yourself. There are at least half a dozen posts with links ...
Qt btw. comes with its own IDE, so only a few use XCcde :)
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
"Kick in the pants"
Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
Hell, judging by recent developments, by that time all languages should have evolved to Lisp.
Don't complain about syntax, grammar, or spelling. There is no.hell like input on android.
(by god i hate reading documention in iBook form, is the most irritating thing known to man pages)
page 10, line 2 of the sample code - this seems to be a comparison operation with no consumer.
following is my opinion only:
in general the swift documentation is *far* too breathless in it's own praise to be believable, i find.
the hell of it is i now have another language to support in my own "portable" products, and another whole learning curve, sorting out all the personal little differences these precious lisping clowns have implemented, to meet a demand that will certain fizzle in a year or so.
unless swift somehow turns out to be genuinely *better* than existing languages, and therefore a real improvement, apple should be taken out and shot, without trial, for pushing bad drugs, essentially, on an already very unhealthy industry.
so far swift has all the hallmarks of a "vanity" product, and appears entirely constructed of existing concepts, so i do not hold much hope.
i will, unfortunately, be forced to learn this new beast, cover to cover, in my work, and i do promise to correct my impressions, should swift prove me wrong.
He keeps ignoring Maya which has been brought up several times.
Don't this code have the problem that you call some_work from the gui thread, and thus will block all updates of the graphics userinterface while some_work is running?
The parent objective-c UI event handler (buttonPressed) has the same constraints as the child C function (some_work). Both should do very very little themselves and/or have a background thread do the work.
Well, thank you Apple for overloading yet another acronym. SWIFT is already popular in the financial industry for transactional information
Calibre is the OSX app with the worst UI I've ever seen. And VLC is pretty bad too, though not as bad as Calibre. So I guess using Qt on OSX isn;t such a great idea.
Although Google Earth is OK. So perhaps if you are careful...
I think he's ignoring these until someone posts the links:
VLC media player for Mac OS X
Download the latest version of Google Earth for PC, Mac, or Linux
The cheese stands alone...
Links in this comment
The cheese stands alone...
Mainstream?
Care to define "Mainstream"? : What percentage of mac users need to run an app for it to be "Mainstream"? How many "Mainstream" mac apps are there, that are not produced by Apple and included with OS X?
Well.. maybe. Or Maybe not. But Definitely not sort of.
That's a matter of taste. For me everything on MacOS X looks like candy-covered shit on acid, but that's my taste.
I hated NeXTStep, too.
I'm old enough to remember when discussions on Slashdot were well informed.
Am I reading this right? That Objective-C is too hard and we need to remove the idea of strongly typed variables? Please, please tell me it isn't so.
Murphy's best law Design a system even a fool can use, and only fools will use it
Murphy was an optimist
"We are talking about UIs, not code for the data model. Hence the term "platform". For non UI C++/Swift code the question of the platform is of nearly no concern (except the size of int etc.)
And your terminology is wrong again, swift is not a technology, it is a programming language."
I don't know what you're talking about, but I and everyone else weren't just talking about UIs, we were talking about whole applications of which the UI is just a part. A platform consists of more than just it's UI. The term platform can encompass everything from the runtime, to the whole OS, to even the hardware itself, but in this context we were talking about software platforms so down to the OS level primarily. Oh and yes, Swift is a technology, programming languages are a type of technology. Technology is a very generic term, an example definition direct from Google:
"the application of scientific knowledge for practical purposes, especially in industry."
I don't know if you have abysmal English and are struggling to say what you're thinking and are coming out with something that's completely nonsense, or if you don't know the topic or what, but you're not making much sense at all given all this.
"No I'm not mixing Swing with SWT."
Then you're simply wrong. Swing uses themes that try to closely represent the OS in question, whereas SWT uses JNI to make calls to the native OS UI functionality. Swing's themes are not identical to the underlying OS UI and there are clear differences that stand out like a sore thumb.
So C, C++, Prolog, SQL are technologies?
Sorry regarding your SWT versus Swing example, you are clearly wrong.
It does not matter how I achieve a platform conform L&F: may it be a Skin or a native call. SWT does not use that many native cals anyway, perhpas you should install an SWT application, like Eclipse, then you notice the hundrets of non platform conform mini flaws :) (regardless of the fact of using JNI)
And please stop turning words around. A programming language is not a platform, nor a technology, so your accusion of 'abysmal english comprehension' is ... well, you insult yourself by continuing to argue.
Our argumemt about Swift, the language, not the technology, not the platform, running on iOS - the platform - and OS X - the platform - came from your 'mashing' everything into one basket. Then you started to suggest I could not architecture a system and I was unable to put reuseable stuff (which is certainly not a UI written in Swift running on iOS and OS X ... and other OSes) into 'libraries'.
Sorry, read your old posts and stop insulting my or your own intelligence.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
"So C, C++, Prolog, SQL are technologies?"
Yes well done, you're beginning to get it now.
"Sorry regarding your SWT versus Swing example, you are clearly wrong."
How exactly? Please elaborate, saying someone is wrong doesn't magically make it so.
"It does not matter how I achieve a platform conform L&F: may it be a Skin or a native call."
Of course it does. If you're just making native calls to the OS' windowing API(s) like Win32, or MFC on Windows or similar on other platforms then you're just using the methods to render UI components that the OS does which means it is by definition rendered to the standard of the OS. If however you use a skin then it relies on you being able to replicate every single element of the underlying OS, which is something that to date, has never been achieved.
"And please stop turning words around. A programming language is not a platform, nor a technology, so your accusion of 'abysmal english comprehension' is ... well, you insult yourself by continuing to argue."
Is there something wrong with you? seriously? I didn't say a programming language was a platform, I said a runtime for a language such as the JVM or the CLR is a platform - it's the execution environment that is the platform. A programming language is however a technology, stop trying to pretend your abysmal understanding of the English language somehow reflects the actual meaning of terms in English, it doesn't. I respect people who make efforts to speak in their non-native language, but not if they start demanding they're right when they misunderstand things. Sorry, but every single English dictionary says you are wrong.
"Sorry, read your old posts and stop insulting my or your own intelligence."
I think you're doing that all by yourself by implying well defined English terms are incorrect, and inventing arguments that were never even made. You don't need me to help you.
I didn't have much time to look at the language guide, but in the short time I already discovered many things that exist in Scala, and even the syntax is very similar:
* Tuples
* Closures
* Swift seems to be a functional programming language, even more than Objective-C (the 'functions'/closures there are called blocks).
* For comprehensions
* var/val is named var/let here
Google in the past launched *Go* language (1) . Who's talking about it today or using? Facebook recently launched a programming language called *Hack* (2). Who's talking about it today or using? I have my doubts about these *own* programming languages. Does it worth? Does it gain high popularity? Or will this ending up being used just inside the companies that created them? It's something to reflect...
What makes you call it a scripting language? It's not interpreted, and it's primary use isn't to control other programs, nor to be embedded in other programs.
It's a full featured compiled language, useful for anything that C, C++, Obj-C or Java would be used for.
Yeah, that definitely shouldn't be overlooked. Apple has a bunch of web-facing apps of their own, implemented in a variety of technologies, including some WebObjects/Java stuff, and some SproutCore/JavaScript stuff. Both of those are essentially clones of portions of (and different generations of) Cocoa (fka NeXTSTEP, which is relevant to recall here, because the WebObjects clone is that old, despite the fact that one of the largest stores on the Internet, iTunes, is built on it).
Here's an interesting political history of WebObjects around the time we last heard from it. As strange as it may seem, there's still an active WebObjects development community despite it being essentially self-supported for nearly a decade, now. Many of the developers in that community were, previously, Objective C developers, and the ones that survived the transition to Java are language agnostics. I suspect they might welcome the opportunity to migrate to a Swift/Cocoa web stack.
It will take some while, but Apple has just made the first step to a "language mindshare" play in the web application space.
If you mod me down, I shall become more powerful than you could possibly imagine.
Time was, phrases like, "if their entire platform doesn't want to play nice with mainstream standards" were deployed by Microsoft dweebs against UNIX geeks. Did you not notice that iPhone apps are written in Objective C / Cocoa? Swift could just as easily be called, The New Objective C, or Objective C^3, or Objective Cocoa, and none of what you're griping about has changed at all, since the iTunes App Store was first deployed. You don't own a Mac, so you're already not in the iTunes App Store market. Why, again, do you care about this discussion, at all?
If you mod me down, I shall become more powerful than you could possibly imagine.
I don't think you get the gist of the post. Qt does a tremendous job, but there are just so many little differences that it is hard to get it right. I've developed using Qt for years and it is probably the best cross platform GUI toolkit out there. Still I can tell in less than a minute if a Mac app is made in Qt or Cocoa. The spacing and alignments of buttons and labels are not quite right. Many things have no clear translation between platforms. E.g. Windows and Linux doesn't have inspectors as a common UI element, or a standard look and placement for preferences dialog. A OSX preference dialog doesn't look anything like one on Linux and Windows.
The alignment of GUI elements used on OSX is hard to achieve with the layout management approach of Qt.
I can't remember if this is right or not off that bat but I believe keyboard focus doesn't work the same way either.
Conventions are just too different. E.g. on windows one loves to have lots of toolbar icons. E.g. for Save, Open etc. This is almost never done on Mac. It is very hard to make a tool translate all these conventions and practices automatically.
turned out the code i was objecting to works in a thing called a sandbox - so a comparison "statement" is legit in the directly interpreted sense - the ibook just assumes i know what a sandbox is, and does, in order to make sense of it's examples.
your point about obj-c is valid, i think - will stick to providing support at this level, let apple and the swift people build their own bridges, if needed.