@property Incorrectly Implemented?

Ethan Watson via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 12 03:00:44 PDT 2016


On Monday, 12 September 2016 at 09:25:40 UTC, Kagamin wrote:
> You mean your serialization library will break if @property 
> changes behavior?

Any serialisation library can break if a property is 
indistinguishable from an ordinary type, as a property is 
explicitly code that returns a value and faces all the allowances 
and restrictions that normal functions have.

In my case, it will break if this template fails:

template IsVariable( X... ) if ( X.length == 1 )
{
   static if( is( X[ 0 ] == void ) || is( typeof( X[ 0 ] ) == void 
) )
   {
     enum IsVariable = false;
   }
   else static if ( !IsSomeType!( X[ 0 ] ) )
   {
     static if( isSomeFunction!( X[ 0 ] ) )
     {
       enum IsVariable = isFunctionPointer!( X[ 0 ] ) || 
isDelegate!( X[ 0 ] );
     }
     else
     {
       enum IsVariable = is( typeof( X [ 0 ] ) )
               && !is( typeof( X [ 0 ] ) == void )
               && IsMutable!( typeof( X[ 0 ] ) );
     }
   }
   else
   {
     enum IsVariable = false;
   }
}


More information about the Digitalmars-d mailing list