On Nov 16, 2007, at 8:00 AM, Christiaan Hofman wrote:
About your code, usually the "id" property is a unique id. This
does not seem to be the case, so it's better not to use "id" for
this name, but something like "number" or "order number" or
something.
OK, I had struggled with that and have renamed it "number" on your
advice. It is a unique order number, but it is not what I would
call an enforced or guaranteed unique ID.
Then you shouldn't use it for your object specifier, as it does not
uniquely identify the object.
Well, maybe. You say it's unique, but not very unique? How unique is
it? [1] The Scripting Interface Guidelines (you have read them,
right?) have this to say about "id" properties:
id
A value that uniquely identifies the object. IDs are never localized
and are typically not under the user’s control and therefore are
read-only. They should at least be unique within a container – in
most applications, they are unique within the entire application –
and must remain valid for at least the lifetime of the application
process or the object, whichever ends first.
The type of value may be anything: common choices are an integer, a
UUID, or a bundle identifier. The type of value for any particular
class should always be the same.
In your case, the key bit is probably "unique within a container". An
"id" attribute doesn't have to be universally unique, it just has to
uniquely identify an item in that container. Having an "id" attribute
is useful, since it lets you say "order id x" instead of "first order
whose order number is x", which is doubly annoying when you know
there's going to be at most one match.
--Chris Nebel
AppleScript Engineering
[1] My old high school librarian maintained that questions like that
were nonsensical. Either something is unique or it isn't; qualifiers
on "unique" make about as much sense as qualifiers on "pregnant". _______________________________________________
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