Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

Abscissa
Copy link
Contributor

@Abscissa Abscissa commented Mar 9, 2012

Replace dur!"minutes"(3) with minutes(3), etc. Maintains a duration!"minutes"(3) for the sake of generic code. The dur is kept as a "to be deprecated" transition path leading up to the preferred alternative of minutes(3) for the majority of code, and duration for the rare cases genericness is needed.

These changes provide decreased verbosity without the need for the contrived and controversial dur abbreviation, and also without removing the ability to be generic.

I would STRONGLY assert that this is NOT a case of "pointless aliasing" in the std lib: The idea here is that minutes()/hours()/etc. ARE the new replacement for dur. The duration is ADDED functionality on top of minutes()/hours()/etc. So why not just use dur/duration instead of minutes()/hours()/etc.? Because in the vast majority of use-cases, dur/duration are needlessly verbose to a degree that's unreasonable for simply referring to X units of Y time.

This is based on discussion, which had overall strong support for the change, in these NG subthreads:

http://forum.dlang.org/post/jj6gjm$2m6a$1@digitalmars.com
http://forum.dlang.org/post/mailman.115.1331078432.4860.digitalmars-d@puremagic.com
http://forum.dlang.org/post/jj6hnv$2o9s$1@digitalmars.com

@Abscissa
Copy link
Contributor Author

Abscissa commented Mar 9, 2012

The following pull requests go together with this:

dlang/phobos#485
dlang/tools#23

@jmdavis
Copy link
Member

jmdavis commented Mar 9, 2012

I am completely against renaming dur to duration. It will break code. And I still think that dur is better than duration, because it's shorter and still plenty clear (and stuff like dur!"minutes" is already annoyling long as it is). I won't accept this pull request as long as that's part of it, and I believe that Walter will agree given his recent comments in the newsgroup and in pull request #173.

I'm also inclined to reject this for adding unnecessary aliases, but they do make it possible to do stuff like 5.seconds(), which some people seem to really like (much as I personally dislike it). So, maybe those will get merged in - but definitely not as long as the renaming of dur is in here.

@MartinNowak
Copy link
Member

@Abscissa
Please reduce this pull request to adding aliases or close it altogether.
There is no point in mass replacing all uses of dur.
If 5.seconds should be possible it needs to be a property but I think
we should leave this field for a more general MKS solution in phobos.

@Abscissa
Copy link
Contributor Author

@dawgfoto

There is no point in mass replacing all uses of dur.

I see no point in not replacing them. It's already done, ready to be pulled. It doesn't hurt anything and it makes the code less verbose and much more readable. And if usage of the aliases is just going to be discouraged like that, then why even have them?

In any case, I've created a new alternative pull request: #188

@andralex
Copy link
Member

andralex commented Jul 8, 2012

So I assume I should just close this, at least for now.

@andralex andralex closed this Jul 8, 2012
@jmdavis
Copy link
Member

jmdavis commented Jul 8, 2012

If it were purely my decision, I would not make any changes like this, but there are a number of people who really want them, and druntime and Phobos aren't my projects, so other people's opinions obviously matter quite a bit. So, I'm a bit divided on it, and that's why I haven't close this previously. I'm fine if you want to close it though.

@alexrp
Copy link
Contributor

alexrp commented Jul 8, 2012

I think #188 supersedes this.

@jmdavis
Copy link
Member

jmdavis commented Jul 8, 2012

@alexrp It's the same thing done differently.

@alexrp
Copy link
Contributor

alexrp commented Jul 8, 2012

Yes, but @andralex closed this because #188 supersedes it, not because of disagreement.

@andralex
Copy link
Member

andralex commented Jul 8, 2012

@alexrp is right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants