POV-Ray : Newsgroups : povray.off-topic : Lots of statistics : Re: C# Server Time
29 Jul 2024 22:20:29 EDT (-0400)
  Re: C#  
From: Darren New
Date: 15 Aug 2012 19:28:17
Message: <502c3091$1@news.povray.org>
On 8/14/2012 7:16, Invisible wrote:
> Well, you're right in that you cannot write any code which explicitly
> expects Bar. You can pass the result to any function that works with /all/
> types, or any function that works with any showable type. If the module
> exported some functions that expect Bar as input, you can pass the result to
> them. But you can't write that in a type signature, which... yeah, is a bit
> silly.

That's what I was saying. You can't return type Bar if you haven't made it 
exposed. You can declare that foo returns a Bar, but you can't actually use 
Bar. It gets the equivalent of being upcast to "object" or to whatever 
interface you've defined it to be. So the fact that you can't return an 
opaque Bar is no hinderance - declare foo to return the appropriate 
interface or Object.

> My point wasn't so much that this is a something anybody is likely to want
> to do. My point was a counter-example to the "that's obviously impossible"
> argument. It's /not/ impossible at all.

By that reasoning, it's possible to do it in C#:

return (Object) Bar;

return (Showable) Bar;

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.