Make dur a property?
Jacob Carlborg
doob at me.com
Wed Jan 23 12:33:07 PST 2013
On 2013-01-23 18:03, monarch_dodra wrote:
> I was using dur, and as powerful as it is, I *hate* typing:
>
> //----
> Thread.sleep(dur!"msecs"(100));
> //----
>
> Then, this reminded me of an older thread I started:
> Neat: UFCS for integer dot operator suffix
> http://forum.dlang.org/thread/uchcycnsvykuojzhuokh@forum.dlang.org
>
> And then it struct me:
> //----
> Thread.sleep(100.dur!"msecs");
> //----
>
> Yay! Or even better:
> //----
> alias msecs = dur!"msecs"
> ...
> Thread.sleep(100.msecs); //Wow. Talk about expressive !!!
This is how it should look like. Date ranges in Ruby on Rails can be
really beautiful:
date = 2.days.ago
I think we should have the same in D.
> What about making things like msecs public aliases? How do you feel
> about that?
Go for it.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list