Re: knowing the interfaces that an object implements



Nick Hall <nickh@xxxxxxxxxxxxxxxxxx> wrote:
> It's not evaluated until runtime - therefore it actually does work. It uses
> the IL instruction isinst to make the determination.

The "if" does, but the call to Dispose should fail at compile time,
because the compiler doesn't know that connection implements
IDisposable. Of course, with Option Strict turned off it would be okay,
but personally I think type-safety is rather important :)

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: ADA Popularity Discussion Request
    ... that error and also caught the logic error in hext at the same time. ... Where it can't make the determination at compile time it generates ... Return to Top Level (an "abort" restart). ...
    (comp.lang.ada)
  • Re: Static vs. Dynamic typing
    ... "Ilja Preuß" writes: ... When using a dynamically typed language, ... > message) - just at runtime instead of compile time. ... Without static checking this will only fail if the call is actually executed ...
    (comp.object)
  • Re: To understand OOP better...
    ... > If the source code invokes f on some object, the determination of the ... > occurs at runtime instead of compile time. ... which is used to define "variations on object oriented style"? ...
    (comp.object)
  • Re: How to conditionally use a specified module
    ... that will still fail if the boolean value is set at runtime since use ... executes at compile time. ...
    (perl.beginners)
  • Re: Dispose and Finalize hell!
    ... If all callers dispose you, you have more freedom to modify the class. ... Or mark the old type Obsolete and copy the original contents to a completely new type. ... There currently are no ways to make sure you've called Dispose on a Disposable object, so if someone adds it at a later time, it should be something that comes up at compile time. ...
    (microsoft.public.dotnet.languages.csharp)