On 21 May 08, at 22:25, Peter Zegelin wrote:
- (void)reset:(RulerStyle*)newStyle:(int)newSide:(int)textLoc: (double)newScale;

That syntax is pretty obscure. Try reading it as

- (void)reset:(RulerStyle*)style
   newStyle:(int)newStyle
    newSide:(int)newSide
    textLoc:(double)newScale;

and see if that makes any more sense. (Some of the types seem a little odd for the argument names, but that's what the method signature reads as.)

If this still doesn't make sense, check the header file for the code you're interfacing with.

I probably should have explained that I am calling my own ruler implementation so that object and method is my own. In C++ it is:

void reset(RulerStyle* newStyle, int newSide, int textLoc, double newScale);

All right - so figure out what your method signature is supposed to be, and write it accordingly. In this case, what you probably want is

- (void)reset:(RulerStyle *newStyle)
      newSide:(int)newSide
      textLoc:(int)textLoc
     newScale:(double)newScale;

You'd call this as

[obj reset:style newSide:123 textLoc:456 newScale:3.14159];

or whatnot.

So my question is - is there a way to include the first label? I note that the examples in the ObjectiveC manual seem to leave the first one out also:

[myRect setWidth:10.0 :15.0]; ---> [myRect setWidth:10.0 height: 15.0];

They shouldn't - that's invalid. Every "label" is a component of the method name - [myRect setWidth:10.0 height:15.0] is calling a completely separate method from [myRect setWidth:10.0 somethingElse: 15.0].

Well that example is straight out of the manual:

<...>
This method name uses unlabeled arguments. Unlabeled arguments make it difficult to determine the kind and purpose of a method’s arguments. Instead, method names should include labels describing each of their arguments...

Interesting - I wasn't aware that unlabeled arguments existed (primarily because they're not used in Cocoa). I'd stay away from them, as they're strictly less clear than named arguments, and will probably confuse other programmers just as they did me._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to