all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: cc-mode Objective C method names
Date: Thu, 2 Jan 2020 11:02:30 +0000	[thread overview]
Message-ID: <20200102110230.GA59584@breton.holly.idiocy.org> (raw)
In-Reply-To: <jwvftgzp5l7.fsf-monnier+emacs@gnu.org>

On Wed, Jan 01, 2020 at 10:29:42AM -0500, Stefan Monnier wrote:
> > And I think the methods’ names should be written something like:
> >
> > -[ClassName doSomething]
> > -[ClassName doSomethingTo:with:]
> 
> These names look very odd to me (as a non-ObjC coder, I find the
> brackets rather ugly and useless for example), but if they're the
> "normal" way to refer to them, then I guess it's fine.

I think it’s the normal way, I’m not very clear as there are very few
examples of people referring to methods without the class being
already known.

For example Apple’s documentation only ever refers to methods like this:

- initWithFrame:

or like this:

- (instancetype)initWithFrame:(NSRect)frameRect;

but in neither case does it tell you which class it’s from, you have
to pick it up from other clues on the page.

> > The ‘-’ means it’s an instance method and a ‘+’ would mean it was a
> > class method.
> 
> Might be best not to include it: how often do you have both a class
> method and an instance method with the same name?
> [ E.g. in Elisp we use the function names and variable names as is,
>   without clarifying if it's a function name or a variable name.  ]

It happens quite often, but not in the Emacs code base, which is
presumably the only place this is of use. So I’ll get rid of that.

> > It appears to work for me, but I’m not great at Emacs lisp so I
> > thought it best to run this by the mailing list in case I’ve made any
> > boneheaded errors.
> 
> This is the code of the other Alan and I'm not very familiar with this
> part of CC-mode, so don't take my opinion too seriously, but it looks
> acceptable to me.

I’ll wait a while and see if he has any comments.

> > +			   (if (looking-at "(")
> > +			       (c-forward-token-2 2 t)
> > +			     (c-forward-token-2 1 t))
> 
> AKA
>    			   (c-forward-token-2 (if (looking-at "(") 2 1) t)

Thanks!
-- 
Alan Third



  reply	other threads:[~2020-01-02 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01 11:27 cc-mode Objective C method names Alan Third
2020-01-01 15:29 ` Stefan Monnier
2020-01-02 11:02   ` Alan Third [this message]
2020-01-01 16:41 ` Eli Zaretskii
2020-01-04 10:48 ` Alan Mackenzie
2020-01-04 11:07   ` HaiJun Zhang
2020-01-04 17:09   ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200102110230.GA59584@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.