Predicate syntax for a conditional expression?
Predicate syntax for a conditional expression?
- Subject: Predicate syntax for a conditional expression?
- From: Jens Alfke <email@hidden>
- Date: Mon, 06 Feb 2017 11:27:08 -0800
[Re-sending now that the lists are back up]
Conditional NSExpressions (NSConditionalExpressionType) were added in 2015, but Apple’s predicate format syntax document* hasn’t been updated, so I can’t find any description of what the syntax is for them in a predicate string.
By reverse-engineering (creating a conditional expression programmatically and then calling -description on it) I found that the syntax “TERNARY(test, iftrue, if false)” works. But this is pretty ugly**; I was hoping there was a cleaner syntax like “test ? iftrue : iffalse” or the more SQL-like “IF test THEN iftrue ELSE iffalse”. Would anyone happen to know if there’s an alternate non-functional syntax?
—Jens
* https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html <https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html>
** Unless you’re a LISP fan, I guess
_______________________________________________
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