Nullable or Optional? Or something else?

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 11 10:39:08 PDT 2009


On Fri, 11 Sep 2009 11:20:03 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Steven Schveighoffer wrote:
>> On Thu, 10 Sep 2009 17:41:19 -0400, Rainer Deyke <rainerd at eldwood.com>  
>> wrote:
>>> Proxies, especially proxies that add functionality to their base type,
>>> cannot act exactly like the type they are proxying.  Using a proxy
>>> therefore requires the significant mental overhead of keeping track of
>>> all the corner cases in which the proxy does not act like the type it  
>>> is
>>> proxying, as well as the hassle of working around those limitation
>>> whenever they come up.
>>  They can act like the base type up to a point.  You make it sound like  
>> a chore to use a wrapper type, but the truth is they are easy to use,  
>> there are not that many cases to worry about.
>
> My experience with wrappers in C++ has been similar to Rainer's.  
> Essentially you can't define "smart references" in C++. I hope we were  
> or will be able to fix that with the "alias this" feature.

My experience with Proxy objects in .Net remoting has been good.  Granted,  
it's not a true wrapper, since the object has to derive from a certain  
base class, but it works very seamlessly without much effort.  I guess  
it's a matter of how much you expect from your wrapper.

I also agree that C++ doesn't allow complete smart references, but we  
aren't dealing with C++ here, are we :)

-Steve



More information about the Digitalmars-d mailing list