Will GNUstep support @property and @synthesize?
Asked Answered
G

3

9

I'm working on a Cocoa app with the intention of using it on Windows and Linux using GNUstep. I've been avoiding Objective-C 2.0 features thus far, but I'd really love to start using at least properties. What Google seems to tell me (though I'm having trouble finding much on the subject) is that currently, no Objective-C 2.0 features work with GNUstep. Does anyone know if there are plans for GNUstep to support @property and @synthesize?

I also wonder if there is a good strategy for "expanding" them? I could certainly imagine a program that could expand code using @property and @synthesize into code that does not use any Objective-C 2.0 features, but I'm worried there isn't much demand for such a thing, so I probably won't be able to find one.

Do you think there is a good chance that GNUstep will support @property and @synthesize in the next year or so?

Goa answered 9/8, 2009 at 4:46 Comment(2)
On the subject of "Don't do it!": It's an interesting situation--I don't need much outside of Foundation, and the majority of the code is tons of my own classes, along with quite a bit of XML reading and writing. Thus, I figured it wouldn't be a big deal to keep compatible with GNUstep. As for making my users install a runtime, I was hoping to combat that with a well-written installer that handles everything for them if they want. (I'm interested to hear any objections you have to those two points, though.)Goa
If anyone's trying to do this: I never was able to get Obj-C 2.0 working with GNUstep, but it seems to work great with Cocotron (though you'll need access to a Mac for compilation).Goa
T
12

This is a few months late, but the answer is yes; GNUstep will support Objective-C 2.0 features (as well as blocks). Currently, everything is more or less implemented, but needs testing and debugging. These features require Clang rather than gcc, and currently you need to use the trunk version.

See David Chisnall's explanation in this thread for more details: http://groups.google.com/group/gnu.gnustep.discuss/browse_thread/thread/b0a5fa4e3be71bb1#

Teratism answered 25/11, 2009 at 2:32 Comment(1)
That link's dead now, but here's a different source with the same info: wiki.gnustep.org/index.php/ObjC2_FAQGoa
P
3

No, I don't know whether there are plans to support properties, but if GNUstep plans to stay viable (even if only in the limited degree to which it is now) this should be a priority. Unless GNUstep decides to adopt Objective-C 2.0 features, the gap between it and Apple's implementation will make it increasingly difficult to write good cross-platform code. (It's already borderline pointless for most developers.)

Although I usually hate answers that essentially say "don't do that, it's a bad idea", I have to agree with @Jonathan on this one, especially from the standpoint of practicality. Although the code may compile cross-platform, if users have to install a runtime just to use your app, the probability that someone will use your app is vastly diminished.

This SO answer sums it up nicely. I suggest reading it and draw your own conclusion.

It's also worth considering that the "objective-c" tag has over 3280 questions, while "gnustep" has 9. I'm not saying that question volume is a metric of quality, but it is a parallel with activity and interest, and quite possibly a low number of people with expertise in GNUstep on this site. Thus, you're less likely to get good help if you choose to go down the path you're considering.

By the way, the mentality of avoiding new features in the name of compatibility is a "least common denominator" behavior that, in the long run, will make your code less elegant and less "featureful". It's similar to only coding with APIs available on 10.2 or 10.3 — any recent OS X or iPhone developer will tell you they'd rather take advantage of the cool new features, and not be hampered by past limitations. These days, new apps almost always require 10.5 — support for older versions is more characteristic of established software that is being backward compatible, and many apps even drop old OS's over time.

If you're considering selling an application, using only GNUstep-compatible APIs will severely limit your market, and even limit your app in fundamental ways, including the level of polish and functionality you can hope to achieve. Even if the app won't be commercial, there is generally merit to using the language and frameworks that are the best fit for a given platform. If you're really looking for cross-platform support, Java is likely to get you closer with less heartburn. (Java is definitely not my favorite language, and it's not Cocoa, but it does many things well.) Although there is still the same problem of language version across clients and platforms, at least it's designed to be cross-platform, and all consumer platforms have solid Java support.

Parulis answered 9/8, 2009 at 14:14 Comment(0)
Q
2

I am not sure whether or not the GNUstep implementation of Objective-C will follow Apple's lead in accessor/mutator synthesis, but if you are trying to make an app for Mac, Windows and Linux, GNUstep is probably not the best choice. It should be pretty easy to port the code from Cocoa to GNUstep (and you might be able to even write a macro to convert your property declarations), but very few people use GNUstep on Linux and even fewer on Windows. I love the idea of a cross-platform OpenStep implementation, but at the moment, it isn't really practical, adoption-wise.

Quotient answered 9/8, 2009 at 6:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.