Make dur a property?

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Wed Jan 23 10:13:05 PST 2013


On Wed, 23 Jan 2013 18:03:19 +0100
"monarch_dodra" <monarchdodra at gmail.com> wrote:

> I was using dur, and as powerful as it is, I *hate* typing:
> 
> //----
> Thread.sleep(dur!"msecs"(100));
> //----
> 

I completely agree. It's absolutely hideous. And the flexibility of
having the unit be a template param is only rarely useful. What we *do*
fortunately have is these:

msecs(100)
hours(12)
days(30)
etc...

But beyond that, unfortunately, it's all been discussed before, and the
guy in charge of std.datetime is very strongly opposed to such changes
and feels that 'dur!"msecs"(100)' is great-looking. It was a ridiculous
uphill battle just to get the aliases above approved and included, and
even then the phobos devs rejected the portions of the pull request that
cleaned up phobos's internal usages of "durrrr" with the
vastly cleaner aliases. Such code cleanup was deemed to be pointless
and something to be avoided.


> 
> Well, if you are compiling with "-property", the compiler forces 
> you to type:
> //----
> Thread.sleep(100.msecs());
> //----
> 
> It is *almost* the same thing, but actually not the same at all. 
> It shatters the "native" feeling of the suffix notation.

The behavior *without* -property turned out to be a broken idea and the
*with* -property was created as the new replacement, intended to
deprecate the old ultimately-flawed behavior. Although that was a long
time ago and there seems to be a lot of reluctance to finally make the
switch because even the admins who admitted the change was necessary
are big fans of the old behavior.

Apparently, there's some fear about breaking code by making -propery
the default *as was always intended*. But that potential breakage was
the whole damn reason for adding the switch in the first place, as a
transitional measure (which has now become what, about a two year
"transition"?). Nevermind that we've had bigger breakages since then
that didn't even have any transition period, and we got by just fine.



More information about the Digitalmars-d mailing list