• 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: Any way to get a warning if a non-boolean type is used in an if expression?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Any way to get a warning if a non-boolean type is used in an if expression? (From: Sean McBride <email@hidden>)
 >Re: Any way to get a warning if a non-boolean type is used in an if expression? (From: Thomas Wetmore <email@hidden>)
 >Re: Any way to get a warning if a non-boolean type is used in an if expression? (From: Jens Alfke <email@hidden>)
 >Re: Any way to get a warning if a non-boolean type is used in an if expression? (From: Thomas Wetmore <email@hidden>)
 >Re: Any way to get a warning if a non-boolean type is used in an if expression? (From: Luther Baker <email@hidden>)

  • Prev by Date: Re: Any way to get a warning if a non-boolean type is used in an if expression?
  • Next by Date: Re: Any way to get a warning if a non-boolean type is used in an if expression?
  • Previous by thread: Re: Any way to get a warning if a non-boolean type is used in an if expression?
  • Next by thread: Re: Any way to get a warning if a non-boolean type is used in an if expression?
  • Index(es):
    • Date
    • Thread