Question about case in ASObj-C and and AppleScript classes

Shane,

It looks like the first letter in ASObj-C classes is always uppercase, and the first letter in AppleScript cases is always lower case. I was thinking about putting a note on the page that states this instead of calling things ASObj-C this, and AppleScript that. Am I correct about the upper and lower case stuff?

Bill

No, that’s not quite correct. As far as I know, AppleScript uses lowercase as part of the effort to make code more sentence-like. Objective-C generally uses prefixes for class names, because they have to be unique, and the prefixes are uppercase to distinguish them as, well, prefixes. Similarly, things like functions, enums and constants use prefixes, for the same reason.

Otherwise the convention is camelCase with a lowercase initial letter, except in the case of well-known abbreviations (such as PDF or URL). That applies to methods and properties, but is also generally followed for variables.

You can read more here:

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html#//apple_ref/doc/uid/TP40011210-CH10-SW1

I looked in Apple’s online book and all the AppleScript classes all start with a lowercase character. I’m not quite sure what you meant in your response about ASObj-C stuff. I suspect I did not phrase my question very well. From what you replied it sounds like all classes have prefixes who’s first character is upper case. It seems like the enums and constants also have an uppercase character for the first letter. Function that are in a framework, but not in a class, is the weird case where it is neither upper or lower case, since there is no class.

My question pertained to the return type classes that are returned from things listed in the ASObj-C Database. It seem like it safe to tell user of the database that if the parameters to a something are lowercase they are AppleScript classes, otherwise the parameter is a ASObj-C case, and if the first letter of the class name of the returned item is lowercase they are AppleScript classes, otherwise they are ASObj-C classes.

The only way to get an AppleScript class returned is to use an “as” operator because ASObj-C will not return an AppleScript type. Therefore I was just just looking for a simple rule I could give to the users as opposed to adding even more clutter to screen by explicitly stating the classes for all the inputs and outputs for every item in the database.

The simple rule is "For the classes in the input parameters, and the returned class, if the first letter in the class name is uppercase it is an ASObj-C class, otherwise it is an AppleScript class.

Bill

Have a look in Standard Additions. There’s POSIX file, and URL. Then there are classes like TIFF picture and JPEG picture.

Prefixes are all-uppercase, to distinguish them as, well, prefixes.

No — they have prefixes. The fact of their case is a consequence, not a defining characteristic.

It’s up to you, but I think that risks just dumbing down the issue.

Thanks Shane. I’ll figure out another way. I tried different colors for input and output, for both AppleScript and ASObj-C but it was too many colors. I’ll keep working on it. This is one case where it is easier to lay that out in a book then in a database.

I don’t want to dumb it down. The individual database entries for methods and properties explain things and the classes have a page that give explanations of them. But in a database list format explanations take up too much room. The database window is pretty packed now for the class item page. Putting more in it is going make the interface less effective.

Bill