Re: ObjC method syntax (was: Re: cocoa-dev digest, Vol 2 #3738 - 11 msgs)
Re: ObjC method syntax (was: Re: cocoa-dev digest, Vol 2 #3738 - 11 msgs)
- Subject: Re: ObjC method syntax (was: Re: cocoa-dev digest, Vol 2 #3738 - 11 msgs)
- From: Erik Hanson <email@hidden>
- Date: Wed, 25 Feb 2004 11:44:45 -0800
On Feb 25, 2004, at 9:14 AM, Allan Odgaard wrote:
On 25. Feb 2004, at 13:42, Glen Low wrote:
Another thing, hopefully not further adding fuel to another language
war, on the topic of ease of syntax...
The [ ] call syntax of ObjC still bugs me. Suppose I want to call
method alloc, so I start typing: [...]
I couldn't agree more! I too often face this problem, and I think it
is a classic.
I have considering automating inserting the start bracket if it is
missing. The only problem is that if we write:
[obj1 msg] msg:[obj2 msg] msg:something]
It would not be able to know where to place the start bracket.
Sometimes it would be possible to know it based on object types (and
which methods they implement), but probably not in most of the cases
-- I was thinking it best just to insert it as far away as possible,
as that would require the most crsr movements to do manually, and thus
would generally be of more value (and statistically I would also think
that this is generally where one most often omits it) -- a friend of
mine suggested allowing to cycle through positions e.g. with escape, I
don't know how well that will work (but it is worth a shot).
I agree that this is a great problem for an editor to solve. Lots of
language deficiencies can be solved with a smart editor. For example,
in Java, you're always importing classes. Smart IDEs like Eclipse and
IDEA will automatically generate and remove the import statements for
you.
I agree with your friend's cycling suggestion. You could try
implementing it much like application switching is done with
command-tab. For example, typing command-[ would insert the bracket in
the closest position. But *holding down* the command key while typing
"[" would temporarily put the bracket in the closest position. You
could then keep hitting "[" to move it farther and farther away. When
you release the command key, the bracket gets permanently inserted into
the current location.
This would be great for parentheses too. I often start an if condition
like this: "if ( a == b )" and then I remember I need to add another
condition: "if ( a == b ) && ( b == c ) )". I'd love to be able to hit
command-( to have my editor insert the "(" right after the "if".
BTW, are you writing an editor or something?
--
Erik Hanson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.