[ nice-Bugs-930132 ] lazy initialization

"SourceForge.net" <[email protected]> Mon, 05 Apr 2004 17:46:46 -0700
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #930132, was opened at 2004-04-06 00:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=930132&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Ka-Hing Cheung (bsponline)
Assigned to: Nobody/Anonymous (nobody)
Summary: lazy initialization

Initial Comment:
It&#039;s common to do this for lazy initialization:
?Blah blah = null;
if (blah == null)
    blah = new Blah();
blah.doThis();

However, this fails because the compiler thinks that
blah maybe null when you call blah.doThis().

If I declare blah as Blah (without ?), then the
compiler complains that I am comparing blah with null
(blah == null).

There should be a way to do this without using a
separate boolean variable to check if blah has been
initialized.

$ nice --version
Nice compiler version 0.9.6 (build 2004.03.05, 14:17:55
UTC)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=930132&group_id=12788


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click