I am currently learning Objective-C on the Mac (using that book:-)) and I was
wondering if Objective-C 2.0 is available on Linux and if it can be used for
gnustep development.
If it is available is it ok to use it for gnustep? If it is not available, are
there any plans to support it? I think especially having a garbage collector
would be quite interesting. Personally I think having a GC would be a
sustantial advantage of gnustep over, e.g. Qt.
If it is partly available, which features can (should) be used? Are blocks
available (which seem to be a propertery Apple extension to C-like languages)?
Is it possible to write applications that can be compiled on both the Mac
using Cocoa and Linux using gnustep?
Greetings,
Michael
> Hi,
>
> I am currently learning Objective-C on the Mac (using that book:-))
> and I was
> wondering if Objective-C 2.0 is available on Linux and if it can be
> used for
> gnustep development.
>
> If it is available is it ok to use it for gnustep? If it is not
> available, are
> there any plans to support it?
It's not available. There are people working on different bits of it,
but no concerted plan.
> I think especially having a garbage collector
> would be quite interesting. Personally I think having a GC would be a
> sustantial advantage of gnustep over, e.g. Qt.
GNUstep has GC support in the make package and base library, but
nowhere else.
It's not quite the same as Apple's implementation, but shares most of
the same API.
I have to say that GC has to be considered at best beta-test quality
and getting it working four you would probably take some effort.
> If it is partly available, which features can (should) be used? Are
> blocks
> available (which seem to be a propertery Apple extension to C-like
> languages)?
I would avoid most of the new features. Largely the gcc compiler
doesn't support them (though David Chisnall is working on adding
support for a lot to Clang). Often the new features are arguably bad.
You should be able to use fast enumeration (the API is there in
gnustep-base, even of the lack of compiler support means that you
won't actually get the promised performance benefit). You should be
able to use GC with some work.
I'd avoid using properties ... even if/when we do get support for
properties, I'd argue that they do more harm to code clarity/design
than can be compensated for by their advantages.
> Is it possible to write applications that can be compiled on both
> the Mac
> using Cocoa and Linux using gnustep?
Sure ... very easy ... just develop on GNUstep and then build from the
GNUstep source on the Mac.
Doing it the other way round is the harder way as it's much easier to
find yourself writing non-portable code on the Mac, but if you stick
strictly to the Cocoa APis (the older ones) you would probably be OK.
Yes.
You can check my Fosdem 2009 presentation on "Cross-platform Objective-
C development using GNUstep" for a general introduction to the topic --
http://www.gnustep.it/nicola/Presentations/index.html
Thanks
> Hi,
>
> I am currently learning Objective-C on the Mac (using that book:-))
> and I was
> wondering if Objective-C 2.0 is available on Linux and if it can be
> used for
> gnustep development.
Yes, it is mostly available, but only if you compile with clang and
link against Étoilé's ObjectiveC2 framework[1].
> If it is available is it ok to use it for gnustep?
Not for core GNUstep code, but certainly for your own code that you
want to use on top of GNUstep.
> If it is not available, are
> there any plans to support it?
Yes.
> I think especially having a garbage collector
> would be quite interesting. Personally I think having a GC would be a
> sustantial advantage of gnustep over, e.g. Qt.
GNUstep has supported the Boehm GC for a while. Gregory has been
working on porting AutoZone too. Using GC is generally not a good
idea, because you will almost certainly find a framework that you want
to use which doesn't support it (and you will also find you can't port
your code to the iPhone). The combination of autorelease pools and
reference counting is usually enough.
> If it is partly available, which features can (should) be used?
For maximum portability, none. The features which will work with
clang and ObjectiveC2.framework are:
- Fast enumeration (support may be missing in some GNUstep classes for
this; patches welcome)
- Declared properties.
- Zero-cost exceptions (requires all code to be compiled with DWARF
exception support).
- The new runtime APIs.
Non-fragile ivars are currently working with clang, but only with the
version of the GNU runtime on my hard disk. This situation should
also be fixed shortly.
I've no idea whether the Boehm GC works with clang-compiled code.
Clang has hooks for supporting GC in the runtime-specific code, which
are currently unimplemented for the GNU runtime. These will be added
when Gregory has finished porting AutoZone.
> Are blocks
> available (which seem to be a propertery Apple extension to C-like
> languages)?
Yes, with the same requirements (compile with clang, link against
ObjectiveC2.framework). Blocks require you to compile your code with -
fblocks. You can test for their availability using the __has_feature
() pseudo-macro.
> Is it possible to write applications that can be compiled on both
> the Mac
> using Cocoa and Linux using gnustep?
Yes, there are a great many examples of this. Remember that Objective-
C 2 is a relatively small set of extensions and Objective-C 1 was used
to write some very large applications and frameworks for two decades.
David
I've noticed that there is activity on
http://svn.gna.org/viewcvs/gnustep/libs/libobjc2/.
I wonder if someone has positive experience in building and running
Objective-C 2.0 code.
If you had success could you please tell us your OS and build issues you
face?
When can we expect to have 'Objective-C 2.0' in GNUstep? Can you tell us
general ideas regarding this?
And where can I find some GNUstep roadmap, plans or strategy list, etc.?
Best regards,
HalypH
--
View this message in context: http://old.nabble.com/Objective-C-2.0-tp25255580p26293021.html
Sent from the GNUstep - General mailing list archive at Nabble.com.
> I've noticed that there is activity on
> http://svn.gna.org/viewcvs/gnustep/libs/libobjc2/.
That would be me. This is an effort to remove some of the cruft from
the GNU runtime, let it build outside gcc, back-port some features
from the Étoilé runtime and pull in the new interfaces from Étoilé's
ObjectiveC2 framework.
> I wonder if someone has positive experience in building and running
> Objective-C 2.0 code.
> If you had success could you please tell us your OS and build issues
> you
> face?
>
> When can we expect to have 'Objective-C 2.0' in GNUstep? Can you
> tell us
> general ideas regarding this?
Objective-C 2 is a marketing buzzword. You will notice that GCC has
no option on OS X to switch between Objective-C 1 and Objective-C 2.
In general, be marketing incorporates the following:
1) Fast enumeration
2) Declared properties
3) Non-fragile ivars
4) Garbage collection
Fast enumeration will work on any code compiled with clang and linked
against a recent GNUstep.
Declared properties will work on any code compiled with clang and
linked against either the ObjectiveC2 framework from Étoilé, in
addition to GCC libobjc, or libobjc2 instead of libobjc. At the
moment, I would recommend the former. libobjc2 is working nicely as a
drop-in replacement on my machine, but it hasn't been well tested.
Only use it if you are willing to fix bugs.
Nonfragile ivars work if you compile with clang and -fobjc-nonfragile-
abi and link against libobjc2. This requires you to avoid using @defs
in your code. Unlike the apple implementation, the fragile and
nonfragile ABIs can be mixed (although subclassing something compiled
for the non-fragile abi with something compiled for the fragile abi
will break if the superclass does not have the layout from the
headers), but this is not recommended.
GNUstep itself does not need to be compiled with clang for any of
these to work.
Garbage collection has existed in GNUstep for years, but I've never
used it so I can't comment on how well it works.
> And where can I find some GNUstep roadmap, plans or strategy list,
> etc.?
We have plans and strategies now? Why wasn't I informed?
David
-- Sent from my IBM 1620