Property Classes

I notice a great deal in ObjC that there is always a class reference on the left side
of the property before the *property
when trying to emulate some ObjC example code into ASObjC I sometimes feel like
i’m not providing enough info, or that I’m leaving something out.

I started to think how could I do this and if I can declare something like:

property NSDictionary : a reference to current application's NSDictionary

why can’t I do this:

property anEntry : a reference to current application's NSDictionary

I was worried that I might have an issue with referring to the class multiple times
but here is what I tried out and it worked:

use AppleScript version "2.4"
use framework "Foundation"

-- classes, constants, and enums used

property NSDictionary : a reference to current application's NSDictionary
property anEntry : a reference to current application's NSDictionary
property anBook : a reference to current application's NSDictionary


set newEntry to my makeNewEntryNamed:"Hello" withType:"test"
-- results -> (NSDictionary) {name:"Hello", type:"test"}
set newBook to my makeNewBookNamed:"ASObjC Explored" withAuthor:"Shane Stanley"
-- results -> (NSDictionary) {name:"ASObjC Explored",author:"Shane Stanley"}

on makeNewEntryNamed:aName withType:aType
	set newEntryObject to anEntry's dictionaryWithObjects:{aName, aType} forKeys:{"name", "type"}
end makeNewEntryNamed:withType:

on makeNewBookNamed:aName withAuthor:aAuthor
	set newEntryObject to anBook's dictionaryWithObjects:{aName, aAuthor} forKeys:{"name", "author"}
end makeNewBookNamed:withAuthor:

an thought’s on this approach?

I might be misunderstanding what you’re trying to achieve, but the result looks awfully like obscufation to me.

I agree with Shane.

And rather than dictionaries I recommend to use custom classes.