March 07, 2012
On Wednesday, March 07, 2012 03:49:46 Adam D. Ruppe wrote:
> Though, I still say the underlying silliness remains ridiculous. currentTime >> currTime.

I don't understand this complaint at all. curr is an incredibly common abbreviation for current.

- Jonathan M Davis
March 07, 2012
On Wednesday, 7 March 2012 at 00:25:19 UTC, Jonathan M Davis wrote:
> On Tuesday, March 06, 2012 17:00:19 Brad Anderson wrote:
>> I wasn't around for the creation of datetime but I'm curious why a boost
>> datetime-like duration construction shortcut approach to durations wasn't
>> used. That is, you can write weeks(1), months(6), years(10), hours(17),
>> minutes(12), etc. (although there is now days(int) for some reason).
>
> Because then you've got incredibly common names used as top-level symbols.

I understand the concern but, for what it's worth, I write project scheduling software professionally so I spend a lot of time working with dates and durations.  I'd have no problem with these being top level even though the chance of symbol clashing would be much higher for me than most programmers.  A standard library's datetime module seems like it should have first dibs on those names anyway.  I think it should gobble up that real estate.

> It's also not generic at all. As it stands, you can have a function which does
> dur!units(value). You can't do that with weeks(1), months(6), etc.
>

That is a very nice feature for me as I have to work in arbitrary base units (seconds, minutes, days, hours, etc.) extensively.  I definitely would want that genericity to remain.  The aliases Nick wrote appear to be a good addition (unless I'm overlooking a problem with them).  You keep the genericity but get brevity with the package.

Although I still haven't really made use of it yet, it was really relieving to find D had such an extensive datetime module.  A lot of languages and libraries try to get away with doing the bare minimum (often just very thin and obvious wrappers over what the OS does) so thank you for putting so much time (I can only assume with how large the module is) and thought into designing something powerful that befits a powerful language.

Regards,
Brad Anderson


> - Jonathan M Davis
March 07, 2012
On 3/6/12 7:32 PM, Brad Anderson wrote:
> On Wednesday, 7 March 2012 at 00:25:19 UTC, Jonathan M Davis wrote:
>> On Tuesday, March 06, 2012 17:00:19 Brad Anderson wrote:
>>> I wasn't around for the creation of datetime but I'm curious why a boost
>>> datetime-like duration construction shortcut approach to durations
>>> wasn't
>>> used. That is, you can write weeks(1), months(6), years(10), hours(17),
>>> minutes(12), etc. (although there is now days(int) for some reason).
>>
>> Because then you've got incredibly common names used as top-level
>> symbols.
>
> I understand the concern but, for what it's worth, I write project
> scheduling software professionally so I spend a lot of time working with
> dates and durations. I'd have no problem with these being top level even
> though the chance of symbol clashing would be much higher for me than
> most programmers. A standard library's datetime module seems like it
> should have first dibs on those names anyway. I think it should gobble
> up that real estate.

In fact there is no such thing as a top level in D. (I was quite surprised to learn that a few years ago, and found it quite brilliant of Walter.)

Andrei


March 07, 2012
On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis wrote:
> On Wednesday, March 07, 2012 03:49:46 Adam D. Ruppe wrote:
>> Though, I still say the underlying silliness remains
>> ridiculous. currentTime >> currTime.
>
> I don't understand this complaint at all. curr is an incredibly common
> abbreviation for current.
>
> - Jonathan M Davis

I agree.  curr isn't exactly uncommon.  I'd personally probably go with currentTime but it's perfectly readable as currTime.

Since it's already in Clock I'd even consider just using 'time' or 'now' but I don't feel strongly about it.

Regards,
Brad Anderson
March 07, 2012
On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis wrote:
> I don't understand this complaint at all. curr is an incredibly common abbreviation for current.

Is it your *first* choice?
March 07, 2012
On Wednesday, March 07, 2012 04:42:50 Adam D. Ruppe wrote:
> On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis
> 
> wrote:
> > I don't understand this complaint at all. curr is an incredibly common abbreviation for current.
> 
> Is it your *first* choice?

Definitely. I would pretty much never use current, because curr will do the job just as well, and it's shorter.

- Jonathan M Davis
March 07, 2012
"Adam D. Ruppe" <destructionator@gmail.com> wrote in message news:bwqkuqhyiygvgqswicvz@forum.dlang.org...
> On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis wrote:
>> I don't understand this complaint at all. curr is an incredibly common abbreviation for current.
>
> Is it your *first* choice?

In the general case, it frequently is for me. In the specific case of Clock.curr(ent)?Time, I'm equally happy either way. Although I agree with whoever it was (Brad?) that said "Clock.now()" would be even better.


March 07, 2012
On Tuesday, March 06, 2012 19:35:29 Andrei Alexandrescu wrote:
> In fact there is no such thing as a top level in D. (I was quite surprised to learn that a few years ago, and found it quite brilliant of Walter.)

True, but if names conflict, you then have to worry about using the full import paths for symbols, which can get annoying. On some level, it's unavoidable, and D has some great tools for minimizing the impact, but I also don't think that there's much reason to pick a name which is likely to cause conflicts with other modules when another name wouldn't, unless the other name is just horrible in comparison.

- Jonathan M Davis
March 07, 2012
On Wed, Mar 07, 2012 at 04:42:50AM +0100, Adam D. Ruppe wrote:
> On Wednesday, 7 March 2012 at 03:24:23 UTC, Jonathan M Davis wrote:
> >I don't understand this complaint at all. curr is an incredibly common abbreviation for current.
> 
> Is it your *first* choice?

My first choice is actually 'cur', but I'm OK with 'curr'. I've consistently used 'cur' for 'current' for at least the last decade and a half, probably more.


T

-- 
Famous last words: I wonder what will happen if I do *this*...
March 07, 2012
On Tue, Mar 06, 2012 at 07:48:37PM -0800, Jonathan M Davis wrote:
> On Tuesday, March 06, 2012 19:35:29 Andrei Alexandrescu wrote:
> > In fact there is no such thing as a top level in D. (I was quite surprised to learn that a few years ago, and found it quite brilliant of Walter.)
> 
> True, but if names conflict, you then have to worry about using the full import paths for symbols, which can get annoying.
[...]

I thought that's what module aliases were for.


T

-- 
Let's call it an accidental feature. -- Larry Wall