Re: Checked Exceptions!
How about a third alternative...
A compiler could examine all the exceptions thrown from a method and bake
the data of the exception types thrown directly into the metadata of the
method. Tools could then examine this and use it as they see fit.
One example of how this could be used is to use auto-completion to provide
catch blocks for some or all of the known exceptions thrown within a scope.
Regardless of how tools could use this data the advantage is that it is not
required and it is backwardly compatible with all existing assemblies. If
the data is not present then the tools would find zero exceptions thrown; as
assemblies get updated by tools that understand the new metadata, it would
automatically get put into them. Also, since the data is generated each time
the assembly is compiled it avoids the problem of the documentation not
matching the code, and it avoids a runtime hit.
DaveL
"Eric Gunnerson [MS]" <ericgu@online. microsoft.com> wrote in message
news:OB3f9mjWDH A.3232@tk2msftn gp13.phx.gbl...[color=blue]
> I think there are a couple of important considerations here.
>
> The first is whether checked exceptions are a good idea in principle.[/color]
There[color=blue]
> are lots of different opinions here - some people think that checked
> exceptions are essential, some think that checked exceptions are good but
> should be used in conjunction with unchecked exceptions, and some think[/color]
that[color=blue]
> checked exceptions cause more problems than they solve. For view against
> checked exceptions from the Java (and C++) world, I suggest looking at[/color]
Bruce[color=blue]
> Eckel's position at
> http://www.mindview.net/Etc/Discussi...ckedExceptions.
>
> The second is what it would actually mean to implement checked exceptions[/color]
on[color=blue]
> the .NET platform. There are two ways you could do it.
>
> You could implement checked exceptions in C# only, but using libraries
> written in other languages would be strange, in that they would not have
> exception information. This probably would not work very well.
>
> The second option would be to implement checked exceptions throughout[/color]
..NET.[color=blue]
> That would mean that all languages would be required to support checked
> exceptions. I think it's fair to say that if Microsoft took that position,
> it would not be a popular one amongst the language implementors, both[/color]
inside[color=blue]
> and outside of Microsoft. We've tried to limit the requirements we impose[/color]
on[color=blue]
> other languages as much as practical, and checked exceptions would be a[/color]
bit[color=blue]
> imposition.
>
> Because of these considerations, checked exceptions are an issue where we
> can't satisfy all of our users. We will continue to explore the issue in[/color]
the[color=blue]
> future.
>
> --
> Eric Gunnerson
>
> Visit the C# product team at http://www.csharp.net
> Eric's blog is at http://blogs.gotdotnet.com/ericgu/
>
> This posting is provided "AS IS" with no warranties, and confers no[/color]
rights.[color=blue]
> "OvErboRed" <overboredNO@SP AMoverbored.net > wrote in message
> news:Xns93CB9B5 064749yangstaov erbored@207.46. 248.16...[color=green]
> > I just read a whole bunch of threads on microsoft.publi c.dotnet.*[/color]
> regarding[color=green]
> > checked exceptions (the longest-running of which seems to be <cJQQ9.4419
> > $j94.834878@new s02.tsnz.net>.
> >
> > My personal belief is that checked exceptions should be required in[/color][/color]
..NET.[color=blue]
> I[color=green]
> > find that many others share the same views as I do. It is extremely
> > frustrating to have to work around this with hacks like Abstract ADO.NET
> > and CLRxLint (which still don't solve the problem).
> >
> > On the other hand, it seems that most of the @microsoft.com posters are
> > ignoring or adamantly refusing to accept the argument (and fact) that
> > exception specification is as essential as parameter and return type
> > specification when it comes to creating well-defined interfaces.
> >
> > I'm wondering if there's any hope at all for MS to introduce checked
> > exceptions into an upcoming iteration of .NET. What would it take to[/color][/color]
move[color=blue][color=green]
> > MS to action (or at least more serious consideration) on such issues as
> > this? I realize that at this point, a shift at such a fundamental level
> > will not be easy, but perhaps this will be something to look forward to[/color][/color]
in[color=blue][color=green]
> > .NET 2.[/color]
>
>[/color]
How about a third alternative...
A compiler could examine all the exceptions thrown from a method and bake
the data of the exception types thrown directly into the metadata of the
method. Tools could then examine this and use it as they see fit.
One example of how this could be used is to use auto-completion to provide
catch blocks for some or all of the known exceptions thrown within a scope.
Regardless of how tools could use this data the advantage is that it is not
required and it is backwardly compatible with all existing assemblies. If
the data is not present then the tools would find zero exceptions thrown; as
assemblies get updated by tools that understand the new metadata, it would
automatically get put into them. Also, since the data is generated each time
the assembly is compiled it avoids the problem of the documentation not
matching the code, and it avoids a runtime hit.
DaveL
"Eric Gunnerson [MS]" <ericgu@online. microsoft.com> wrote in message
news:OB3f9mjWDH A.3232@tk2msftn gp13.phx.gbl...[color=blue]
> I think there are a couple of important considerations here.
>
> The first is whether checked exceptions are a good idea in principle.[/color]
There[color=blue]
> are lots of different opinions here - some people think that checked
> exceptions are essential, some think that checked exceptions are good but
> should be used in conjunction with unchecked exceptions, and some think[/color]
that[color=blue]
> checked exceptions cause more problems than they solve. For view against
> checked exceptions from the Java (and C++) world, I suggest looking at[/color]
Bruce[color=blue]
> Eckel's position at
> http://www.mindview.net/Etc/Discussi...ckedExceptions.
>
> The second is what it would actually mean to implement checked exceptions[/color]
on[color=blue]
> the .NET platform. There are two ways you could do it.
>
> You could implement checked exceptions in C# only, but using libraries
> written in other languages would be strange, in that they would not have
> exception information. This probably would not work very well.
>
> The second option would be to implement checked exceptions throughout[/color]
..NET.[color=blue]
> That would mean that all languages would be required to support checked
> exceptions. I think it's fair to say that if Microsoft took that position,
> it would not be a popular one amongst the language implementors, both[/color]
inside[color=blue]
> and outside of Microsoft. We've tried to limit the requirements we impose[/color]
on[color=blue]
> other languages as much as practical, and checked exceptions would be a[/color]
bit[color=blue]
> imposition.
>
> Because of these considerations, checked exceptions are an issue where we
> can't satisfy all of our users. We will continue to explore the issue in[/color]
the[color=blue]
> future.
>
> --
> Eric Gunnerson
>
> Visit the C# product team at http://www.csharp.net
> Eric's blog is at http://blogs.gotdotnet.com/ericgu/
>
> This posting is provided "AS IS" with no warranties, and confers no[/color]
rights.[color=blue]
> "OvErboRed" <overboredNO@SP AMoverbored.net > wrote in message
> news:Xns93CB9B5 064749yangstaov erbored@207.46. 248.16...[color=green]
> > I just read a whole bunch of threads on microsoft.publi c.dotnet.*[/color]
> regarding[color=green]
> > checked exceptions (the longest-running of which seems to be <cJQQ9.4419
> > $j94.834878@new s02.tsnz.net>.
> >
> > My personal belief is that checked exceptions should be required in[/color][/color]
..NET.[color=blue]
> I[color=green]
> > find that many others share the same views as I do. It is extremely
> > frustrating to have to work around this with hacks like Abstract ADO.NET
> > and CLRxLint (which still don't solve the problem).
> >
> > On the other hand, it seems that most of the @microsoft.com posters are
> > ignoring or adamantly refusing to accept the argument (and fact) that
> > exception specification is as essential as parameter and return type
> > specification when it comes to creating well-defined interfaces.
> >
> > I'm wondering if there's any hope at all for MS to introduce checked
> > exceptions into an upcoming iteration of .NET. What would it take to[/color][/color]
move[color=blue][color=green]
> > MS to action (or at least more serious consideration) on such issues as
> > this? I realize that at this point, a shift at such a fundamental level
> > will not be easy, but perhaps this will be something to look forward to[/color][/color]
in[color=blue][color=green]
> > .NET 2.[/color]
>
>[/color]
Comment