Proposal: Relax rules for 'pure'

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 24 07:47:16 PDT 2010


On Fri, 24 Sep 2010 10:33:10 -0400, Robert Jacques <sandford at jhu.edu>  
wrote:

> On Fri, 24 Sep 2010 09:32:40 -0400, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>> structs can have value copy semantics.  But for a struct that contains  
>> a reference, the references have reference semantics, which makes the  
>> struct a reference type.
>
> A struct is never a reference type. It may have reference semantics, but  
> this is a high-order feature that is uncheckable by the compiler. At  
> best the compiler can detect that a struct contains references, not how  
> those references are exposed/managed by the API.

Containing references means it cannot be cast to immutable, the only  
important thing when determining the strength of purity here.

This whole discussion is going nowhere, you haven't made any real points.   
Can you think of a case where the compiler would be wrong in determining  
purity strength for "value types" as you define them?  An example would be  
most helpful.

-Steve


More information about the Digitalmars-d mailing list