I think you should familiarize with AppKit first. Do it on the mac with
a tutorial for 10.2 ... 10.4 and you should find concepts very similar
to GNUstep. and quite applicable. We support also 10.5 and 10.6
features, but the developer app paradigm did not follow apple's.
We still distinguish between the project builder and the interface
builder and I'm happy it is as it is, apple is changing many thing
gratuitously so it can make shiny new features which each release.
> - I dragged a "Title" to my window, but I found no way to change its
> caption. The Inspector only allows to change the color and alignment
> properties. Does this need to be changed programatically?
As "Title" do you mean a box? You may edit some properties in the
inspector, some other direclty by double-clicking the text in the window
(sometimes triple-click, the first needs to select the item)
> - I found no way to create connections between outlets by dragging
> like I do in Xcode. How is this done? (It may simply be that I don't
> have any connectable properties yet!)
Exactly like in InterfaceBuilder: ctrl-drag from source to target, then
int he inspector select the action or outlet. Beware that it needs to
exist. To do this you either need to load the class to parse the header
(you can quite safely reparse it) or add it manually with the correct
name. You you can create all outlets and generate the headers automatically.
> - Using @property for my controls had errors. Is this not supported in
> GNUStep? (It's OK, if it isn't, I don't have a problem with manually
> creating my properties).
that's obj-c 2.0 stuff. You need gcc 4.6 or clang.
You may want to check out the classic calculator tutorial by Pierr Yves
which was recently updated to current gnustep tools.
http://www.gnustep.org/experience/PierresDevTutorial/index.html
Riccardo
> Problem is in the compiler. I think GCC 4.6 introduced Objective-C 2.0 features. You can try using clang compiler, and you'd probably need to switch to libobjc2 runtime; I did not, but your mileage may vary. If you're under Debian (which, although it contains a deceptively named package "libobjc2", does not include the actual "libobjc2") I have a small blog post about this:
Not quite. GNUstep-base includes a compatibility framework that implements most of this stuff on top of the old GCC Objective-C runtime. All of the property-related stuff should work. The additional things you get from libobjc2 are:
- Property introspection (I think - clang emits this data for both ABIs, so we can probably add this if it's missing)
- Unique protocols (two protocols returned by @protocol() may give different sets of methods - this requires a little bit of help from the compiler, not sure if GCC 4.6 does it)
- Cacheable method lookup (requires support from your compiler's optimiser to be really useful - currently only implemented as LLVM optimisation passes, so only useable with clang and LanguageKit)
- Accelerated proxies (-forwardingTargetForSelector: is very cheap)
- Non-fragile ivars (requires a compiler that supports the new ABI, currently only clang)
- Type-checked method lookup (calls a handler when you call a method with the wrong signature, by default just logs a message in debug mode or does nothing in release mode, can throw an exception or generate a fixup method).
David
-- Sent from my Cray X1
Do you have an example/testcase of what you mean by this ?
Thanks
On 8 Apr 2011, at 22:24, Ivan Vučica wrote:Not quite. GNUstep-base includes a compatibility framework that implements most of this stuff on top of the old GCC Objective-C runtime. All of the property-related stuff should work. The additional things you get from libobjc2 are:
> Problem is in the compiler. I think GCC 4.6 introduced Objective-C 2.0 features. You can try using clang compiler, and you'd probably need to switch to libobjc2 runtime; I did not, but your mileage may vary. If you're under Debian (which, although it contains a deceptively named package "libobjc2", does not include the actual "libobjc2") I have a small blog post about this:
No, you are perfectly right. You need GCC 4.6, or clang, if you want
@property, @synthesize, etc. :-)
Thanks
> This does not change the fact that older non-Apple GCC does not know about the syntax changes: @property, @synthesize, et al. Or am I wrong?
Nope, although the problem here is that GORM's ad-hoc parser also doesn't know about them. Hopefully we can make GORM use libclang instead at some point soon, and then it can understand everything that the compiler can understand.
David
-- Sent from my PDP-11
The runtime only sees protocols that are attached to classes. If you declare a protocol in a compilation unit and then reference it with @protocol(), the compiler will generate a reference to it, but the runtime won't see it. If you DON'T declare the protocol, but still reference it with @protocol(), then the runtime still won't see it, and the compiler will generate a stub protocol that only has the name filled in.
If the runtime sees the protocol, then it can add it to a table and update all other references to the protocol to use the same metadata (required / optional methods / properties). The GNUstep runtime does this, and I think the GCC 4.6 runtime does too.
To ensure that the runtime sees all protocols, I added a really ugly hack, where every protocol that is referenced but not attached to a class or category is implicitly added as a category on a class called __ObjC_Protocol_Holder_Ugly_Hack. This ensures that the runtime sees all protocols. The Apple solution to this is to make every protocol a public symbol with link-once ODR linkage (in definitions, external linkage in references) so you get a linker error if you reference a protocol that is declared, or declare it in two different ways. I'll probably do that at some point with the new ABI, but the ugly hack needs to stay for a bit for compatibility.
This is documented in README in libobjc2 svn.
David
-- Sent from my IBM 1620