[SVN] Revised names for class, function, and tag names/parameters

Allan Odgaard allan at macromates.com
Mon May 2 10:47:10 UTC 2005


On May 1, 2005, at 22:31, Jeroen van der Ham wrote:

>>    entity.parameter.attribute.tag
>>    entity.parameter.parent.class
>>    entity.parameter.variable.function
>>
>>    keyword.entity.name-of-parameter.function
> Could you give examples of these? Because you lost me with those.
> All the others seem like a pretty good idea.

Okay, for the keyword.entity.name-of-parameter.function that's because 
some languages allow an argument to have a name. For example in 
Objective-C the declaration of a method looks like this:
   - (BOOL)compareTo:(NSString*)aString caseSensitive:(BOOL)flag

So we'd call it like this:
   [@"foo" compareTo:@"Foo" caseSensitive:NO];

The second argument (NO) consists (in the declaration) of 3 parts:
   caseSensitive: -- name of argument
   BOOL           -- type of argument
   flag           -- the name of the variable used in the method

Some may argue that in fact the method is really called 
“compareTo:caseSensitive:” and takes two arguments, so the above is 
just fancy notation for @"foo"->compareTo:caseSensitive:(@"Foo", NO);. 
But in the declaration it does look like the name of the 
parameter/argument -- there are other languages which also support 
named parameters, but I think they all do it more at the calling time 
than declaration time (by e.g. collecting arguments in a dictionary), 
so in these languages, there'd be nothing to style.

As for the entity.parameter that's the argument variable of the 
function, e.g. in the above “aString” and “flag” would be the 
parameter. For tags, it's the name of the attribute, e.g.: <aTag 
parameter="value">, and for classes which inherit from a 
base/superclass it's the name of the base/super class.




More information about the textmate-dev mailing list