Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New ObjC style language development




2005/08/21 v 23:58, Jens Ayton:
Adam Nohejl wrote:

Category syntax is a bit odd from my point of view. Their name doesn't always appear together with the respective class name (in ObjC: Class(Category)). This fact and the EXTENDS keyword makes methink of inheritace (that's also what it means in Java - another Cocoa/GNUstep language) rather than categories.

...

I suppose that this is a better way to go if you want your extensions to be as close to ObjC as possible. The current syntax would be confusing for both ObjC and Java developers.


How about "ALTERS"?

For me it's certainly better if keywords are more suitable for Modula than parentheses.



Also, a nitpick: the Interface sample contains:

CLASS METHOD initWithFoo: (foo : Foo) andBar: (bar : Bar) : FooBar;

  According to Cocoa/OpenStep practice, init* should be an instance
method. The corresponding class method would be newWithFoo:andBar:, or
fooBarWithFoo:andBar: if it autorelease the return value. Also, the
return type should be OBJECT to allow clean overriding of superclass
initialisers with the same name.


That's right. But after looking at the implementation it doesn't seem to be a property of Obj-Modula, rather a badly coded example:

CLASS METHOD initWithFoo: (foo : Foo)
                  andBar: (bar : Bar) : FooBar;

VAR
  thisInstance : FooBar;

BEGIN
  thisInstance := [[FooBar alloc] init];
  thisInstance^.foo := foo;
  thisInstance^.bar := bar;
  RETURN thisInstance;
END;

Because initWith... shouldn't call +alloc and init should call the designated initializer (the most precise initWith...) in most cases, class method shouldn't access instance variables etc. So everything seems to be the other way around.

There's a lot of things missing too. I wonder about stuff like @class, @selector, @encode and exception handling. I also don't know how much Modula-2 differs from C in terms of types (different types of integers, floats, arrays, function pointers, conventions for strings, ...) and how this would be resolved. It would be interesting for people completely new to Modula-2 to know whether calling functions written in C and passing all the types of arguments already works in some way or it has yet to be implemented for ObjM2.

I remember the Pascal heritage in Mac OS like length-prefixed strings and Pascal calling conventions. But Modula may be different.

--
Adam Nohejl
Loki Software
mailto:email@hidden
http://lokisw.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden
References: 
 >New ObjC style language development (From: ObjM2 <email@hidden>)
 >Re: New ObjC style language development (From: Adam Nohejl <email@hidden>)
 >Re: New ObjC style language development (From: Jens Ayton <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.