Re: Any way to get a warning if a non-boolean type is used in an if expression?
Re: Any way to get a warning if a non-boolean type is used in an if expression?
- Subject: Re: Any way to get a warning if a non-boolean type is used in an if expression?
- From: Jens Alfke <email@hidden>
- Date: Fri, 18 Oct 2013 07:34:11 -0700
On Oct 17, 2013, at 9:45 PM, Luther Baker < email@hidden> wrote: Hey, aren't we forgetting something here! The real reason we write software and the real reason we use objective-c. We are software programmers that like OO ... and, we like our code close to the metal! …... Going all 'smalltalk'ian :)
Implementing conditionals as methods is about as far from the metal as you can get. Even Smalltalk-80, which used this mechanism, found it necessary to hardwire these in the compiler and generate direct comparison/branching bytecode instructions instead of calling the methods at runtime, because it was just way too slow.
Your suggestion would also require an explosion of different methods for every possible type of comparison — you’re basically re-inventing NSExpression and NSPredicate. And you haven’t addressed comparing scalars instead of objects — you’d need another zillion variants taking every combination of scalar types.
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden