• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: KVG generic enough?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVG generic enough?


  • Subject: Re: KVG generic enough?
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 21 Jul 2012 15:27:26 -0700

On Jul 18, 2012, at 4:46 PM, William Squires <email@hidden> wrote:

> For example, an effect could be called "fireball" and do 1d6 HP to a player caught in the blast radius. My 'effect' class has an @property of type NSMutableArray (which holds 'codons' in NSStrings) of the form:
>
> <keypath><assignment operator><value>
>
> and the parser will check the <assignment> for '=', '+=', '-=', '*=' and '/=', evaluate the <value> portion, and pass those on to the player object via valueForKey: (to get the property's initial value before the assignment, and setValue:forKey: to set the new value.

This sounds kind of like a rule system, like WebObjects used to include in DirectToWeb (D2W), as a feature atop KVC and EOQualifier.

Rather than using strings you need to parse as your model for something like this, things will be easier if you use a distinct class.

For example, you could create a class that has a key path and an NSExpression used to generate a value based on parameters passed in (such as the original value at the key path). Then not only do you not have to do the parsing, you also get more features "free" because you can use everything NSExpression provides.

  -- Chris

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >KVG generic enough? (From: William Squires <email@hidden>)
 >Re: KVG generic enough? (From: Marco Tabini <email@hidden>)
 >Re: KVG generic enough? (From: William Squires <email@hidden>)

  • Prev by Date: Re: 10.7 Full-Screen transition animation corrupts my UI - how to avoid?
  • Next by Date: Re: saving images
  • Previous by thread: Re: KVG generic enough?
  • Next by thread: Re: KVG generic enough?
  • Index(es):
    • Date
    • Thread