classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NYIException


From: Stuart Ballard
Subject: Re: NYIException
Date: Mon, 29 Sep 2003 12:51:00 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2

Andrew Haley wrote:
Out of interest (and please forgive me if this has already been
discussed at length) why have dummy methods at all?  Wouldn't it be
better to have a compile time failure for unimplemented methods?

One reason is that it makes it possible to compile code against Classpath that includes references to methods that Classpath hasn't yet implemented. This code might run just fine for the purpose you need it, because the unimplemented calls are in a codepath that you aren't taking.

Another reason to have NYIError[1] is that in some cases a method may be implemented for some cases and not others, depending on its arguments. For example, a method might not have the correct behavior implemented as fallback for when one of its arguments is null, or might only work for particular subclasses of the class it's supposed to take as an argument. In that case, throwing the Error can be done conditionally, which is something that couldn't be replicated at compile time.

Stuart.

[1] yes, I vote for Error, FWIW, but I could live with anything that's a distinct class - ie not 'new RuntimeException("NYI")' - wherever it's placed in the Exception hierarchy.


--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net





reply via email to

[Prev in Thread] Current Thread [Next in Thread]