[phobos] Time to get ready for the next release

Robert Jacques sandford at jhu.edu
Fri Apr 22 11:20:21 PDT 2011


On Fri, 22 Apr 2011 13:22:31 -0400, Steve Schveighoffer  
<schveiguy at yahoo.com> wrote:
>> From: Robert Jacques <sandford at jhu.edu>
[snip]
>> Forth, came the realization that in D2 'seconds' would probably be  
>> pure, which would cause s.seconds = 5 to be compiler error.
>
> No, it wouldn't be an error.  s.seconds(5) is exactly the same as  
> TimeSpan.seconds(5), both would be callable as pure functions.  In other  
> words, s isn't actually passed to the function, it's just used as a  
> namespace.

I apologize, pure alone wouldn't be enough to cause a compiler error. I  
was thinking of the fact that DMD could/does error on expressions which do  
nothing. However, pure wouldn't be enough to let the compiler know  
'seconds = 5' does nothing. It would probably take a combination of  
const/immutable + pure + nothrow, for DMD to detect that s.seconds = 5  
could not possible produce useful work, and therefore should error.


More information about the phobos mailing list