POV-Ray : Newsgroups : povray.off-topic : Monads in C# : Re: Monads in C# Server Time
29 Jul 2024 22:25:53 EDT (-0400)
  Re: Monads in C#  
From: Warp
Date: 3 Jul 2011 13:30:58
Message: <4e10a752@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> On 7/2/2011 13:52, Warp wrote:
> >    What does X.Value return if X.HasValue is false?

> Oh, and for what it's worth, "X = null;" does the same as setting 
> "X.HasValue=false" and "X == null" is the same as "!X.HasValue". Just 
> syntactic sugar the compiler puts in during one of the very early passes. 
> Not something easy to do with C++ just that way, I suspect?

  I suppose you could add an assignment and comparison operator to the
'Nullable' class that takes a void* as parameter, and which set the
'mHasValue' to false if that parameter is null. (An interesting question
is what should happen if the parameter is not null.)

-- 
                                                          - Warp


Post a reply to this message

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