On Wednesday, January 23, 2013 21:54:54 Jacob Carlborg wrote: > On 2013-01-23 21:46, Jonathan M Davis wrote: > > I confess that it's syntax like that that makes dislike UFCS. I can see > > why > > you might like it, but personally, I find it to be hideous. > > > > But as long as you're not using -property, you can do 2.days to get a > > Duration of 2 days, much as I wish that you couldn't. > > The point is that the code should read like regular text.
I know that that's what you're going for, but I don't agree with it at all. It's code, not a novel. > But if you do: > > auto t = ago(days(2)); > > It's backwards I've programmed enough in functional languages (and in a functional style in non-functional languages) to find 2.days().ago() to be horribly backwards. > but it's still better than: > > auto a = Time.now() - 60 * 60 * 24 * 2; // don't know the exact syntax Well, of course that's horrible. It's using naked numbers. The correct syntax would be auto a = Clock.currTime() - dur!"days"(2); or if you don't want to use dur auto a = Clock.currTime() - days(2); And I see no problem with that. - Jonathan M Davis
