Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Element "initializers"



I'm working on an AppleScript class for my application and I'd like to create some properties that can be defined when an instance of the class is created, but which are read-only afterward.

For example, the instances of the class include the "name" and "category" properties. These properties are defined when the instance is created, and can be read afterward, but there should not be any way to change those properties.

I'm curious about the right way to express that in the sdef and in the running application. I envision two scenarios:

1. I mark the properties as "read-only" in the sdef and require the user to specify the value of those properties in the "with properties" parameter of the "make" command. Can a read-only property still be initialized with the "with properties" parameter?

2. I leave the properties read/write but just return an error if you try to set the value after the instance is created.

Is either of these scenarios the preferred one? (or is there some other mechanism that would work better?)

Scott


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-implementors mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.