2

Do the + or - symbols at the beginning of a method's declaration -- for class and instance methods respectively -- have a name?

By name I mean something like "method descriptor" or "method type indicator", or something similar.

jscs
  • 63,694
  • 13
  • 151
  • 195
Earl Grey
  • 7,426
  • 6
  • 39
  • 59
  • 2
    Could you give us an idea of the context you're looking to use it in? I would normally refer to them directly as 'class methods' or 'instance methods'. – sapi Jan 25 '15 at 23:42
  • I am asking specifically about the + or - sign from the perspective of objC language. Those are mathematical characters used in a very specific context. Does objC call them somehow? I am contemplating this on the same level of abstraction as words like "method signature", "selector", "keyword", "preprocessor directive"...etc.. Is there such a word that describes those two signs in objc specific context? – Earl Grey Jan 25 '15 at 23:45
  • 1
    I've never seen a name for the actual +/- characters. Likely there is something in the compiler's source code, but there's never been a great need to expose it. – Hot Licks Jan 25 '15 at 23:47
  • If I had to come up with a term, I'd probably call them something like 'method type indicators'. Alternatively (and arguably preferably), you could consider them to be part of the method signature. – sapi Jan 26 '15 at 00:02
  • I've never heard an official name, but i tend to think of `+` as denoting a `static` method, vs an instance method. – Nick Jan 26 '15 at 02:46
  • 1
    [Not static methods](http://stackoverflow.com/a/8089623/), @Nick. – jscs Jan 26 '15 at 08:47

1 Answers1

2

I agree with Hot Licks; I've never seen a name for these tokens in any documentation, and the relevant part of Clang's parser

Decl *Parser::ParseObjCMethodPrototype(tok::ObjCKeywordKind MethodImplKind,
                                       bool MethodDefinition) {
  assert((Tok.is(tok::minus) || Tok.is(tok::plus)) && "expected +/-");

just calls them "plus" and "minus". (See also ParseObjc.cpp line 322; the same.)

"Method type indicator" sounds pretty reasonable to me, though, if you really need something. I personally would easily understand what you were talking about.

Community
  • 1
  • 1
jscs
  • 63,694
  • 13
  • 151
  • 195