• 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: Chuck officially wins
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Chuck officially wins


  • Subject: Re: Chuck officially wins
  • From: Lachlan Deck <email@hidden>
  • Date: Fri, 5 Dec 2008 13:31:03 +1100

On 02/12/2008, at 10:17 AM, Mike Schrag wrote:

In the long running debate over return null vs return page, I officially concede to Chuck :) I have long maintained that returning null really doesn't matter that much, but I just found a case where it does. If you have a repetition over an array and you have a delete method that deletes objects from that array, you can explode if you return null. The loop that calls invokeAction on all of the items in the list caches the size of the list before going into the loop. It loops while i < count && woactionresults == null. That means if you delete item #3 from a 3 item long list and return null from your delete method, you will IndexOutBoundsException when it tries to go to the 3rd item in the list (in a now 2-item-long list). I'm actually kind of surprised I haven't seen this before ... maybe just a fluke of this particular use case, but given this error, I would now maintain that it's not just an issue of performance and now an issue of correctness and therefore you should never return null. Be aware that this is what happens when you question Chuck in a public forum :)

A new twist...

Well - I've just come across a situation where context().page() doesn't do the right thing whereas 'this' does. I'm not sure why.

I tried changes some old code that returned 'this' to context().page() and it must have been confused because I got the main component rather than what I normally got.

with regards,
--

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Chuck officially wins
      • From: Chuck Hill <email@hidden>
References: 
 >Chuck officially wins (From: Mike Schrag <email@hidden>)

  • Prev by Date: D2W and Ajax
  • Next by Date: Re: D2W and Ajax
  • Previous by thread: Re: Chuck officially wins
  • Next by thread: Re: Chuck officially wins
  • Index(es):
    • Date
    • Thread