Re: Reporting errors from key-value-coding accessors
Re: Reporting errors from key-value-coding accessors
- Subject: Re: Reporting errors from key-value-coding accessors
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 20 Aug 2005 09:49:29 -0400
on 2005-08-19 8:17 PM, Mark Alldritt at email@hidden wrote:
>> 1) For Cocoa Scripting, the best option is to use a parallel set of
>> Cocoa Scripting KVC accessors. This is usually necessary anyway, as
>> the semantics of scripted mutation/access can differ from UI or
>> internal mutation/access, and separate accessors are the only way to
>> enforce read-only properties (although you can mark a property as
>> read-only in the dictionary, Cocoa Scripting does not check that).
>>
>> The parallel accessor just calls the primitive accessor and may also
>> perform validation using the validation methods.
>
> [Th]e thought of maintaining all these parallel accessors is daunting. In
C++,
> one would write templates to machine generate this kind of thing. Is there
> some Objective-C way of (a) generating all this code, and (b) validating
> that its all in-sync at compile time?
I think he was greatly overstating the need for parallel scripting
accessors, although it does strike me as a pretty clean way to do it if you
keep your sources organized well (such as using a separate AppleScript
category file for the AppleScript accessors). I'm working on these issues
now, and so far I seem to be able to put everything I need into a single
getter -- though of course it becomes a bit more complex than one is used
to, what with all the undo action naming and Core Data paraphernalia that
ends up in the getter. Perhaps it's six of one and half a dozen of the
other.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden