Re: NSExpression is incorrect?

2010-11-22 Thread Dave DeLong
Thanks for this suggestion, Ben. I ultimately went with a combination of this suggestion (dynamically determining associativity) and Ronald's suggestion (allowing the user to choose). My parser will start with the associativity used by NSExpression, but provides a property to change it. Thank

Re: NSExpression is incorrect?

2010-11-21 Thread Ben Haller
Another option would be to make your code mimic whatever NSExpression is doing on that machine, by evaluating 2 ** 3 ** 2 (once, and caching the result) and seeing whether it comes out as 64 or 512. That way if/when Apple fixes their bug, your code will seamlessly follow suit. Which of the

Re: NSExpression is incorrect?

2010-11-20 Thread Roland King
I agree with you that exponentiation is usually defined as right-associative. How about a compatibility switch in your code which you can flip to make it work either way. On 21-Nov-2010, at 11:25 AM, Dave DeLong wrote: > Hi everyone, > > Let's say I have the string @"2 ** 3 ** 2". I can run

Re: NSExpression with constant NSData value crashes Core Data

2009-05-22 Thread Jerry Krinock
On 2009 May 22, at 13:54, Ben Trumbull wrote: Uhm, No. %@ is the vararg specifier for an NSObject. - stringWithFormat: turns that into a string. Because - stringWithFormat: turns everything into a string. Kinda the point. -predicateWithFormat: does NOT call -description randomly. Pred

re: NSExpression with constant NSData value crashes Core Data

2009-05-22 Thread Ben Trumbull
On 2009 May 17, at 15:10, Ben Trumbull wrote: Core Data supports == and != searches against binary data. You should be able to just use a predicate like: [NSPredicate predicateWithFormat:@"myTransformableAttribute = %@", myGuidObject] and have it "just work". Read the above carefully! myGu

Re: NSExpression

2008-06-29 Thread Nathan Kinsinger
On Jun 28, 2008, at 11:35 PM, Chris wrote: If anyone has a clue how to use it, I'd be grateful. This was my unsuccessful attempt: NSExpression * ex = [NSExpression expressionForFunction: [NSExpression expressionForConstantValue:@"BAR"] selectorName:@"length" arguments:nil]; NSPredicat

Re: NSExpression

2008-06-29 Thread mmalc crawford
On Jun 28, 2008, at 10:35 PM, Chris wrote: NSExpression * ex = [NSExpression expressionForFunction: [NSExpression expressionForConstantValue:@"BAR"] selectorName:@"length" arguments:nil]; NSPredicate * predicate = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObject:

Re: NSExpression

2008-06-28 Thread Chris
If anyone has a clue how to use it, I'd be grateful. This was my unsuccessful attempt: NSExpression * ex = [NSExpression expressionForFunction:[NSExpression expressionForConstantValue:@"BAR"] selectorName:@"length" arguments:nil]; NSPredicate * predicate = [NSCompoundPredicate andPr

Re: NSExpression

2008-06-28 Thread Shawn Erickson
On Jun 28, 2008, at 12:13 AM, Chris <[EMAIL PROTECTED]> wrote: NSExpression defines this method: + (NSExpression *)expressionForFunction:(NSString *)name arguments: (NSArray *)parameters and the doco provides this example: [NSExpression expressionForFunction:(@selector(random)) arguments