April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 2010-04-27 10:58:33 -0400, bearophile <bearophileHUGS@lycos.com> said: > In D2 the runtime of Phobos and Tango have being merged, so all D programmers can install both libs. So the two libs must have distinct contents. > So I'm for removing the time module from Phobos, and keep only the Tango one. So this module is waste of time, and efforts have to be redirected in improving or rewriting the time module of Tango. > Othrwise in D2 it will happen the same mess it's happend in D1, where you have two partially duplicated libs. All D2 programmers will want to install both libs, and they will not desire to choose what time lib to use. One time lit is enough. Tango's license is more restrictive than Phobos. It might not be a concern to you, but this is one reason someone might not want to use Tango in a project. Saying everyone will always want to use both libs is a little too much optimistic in my opinion. Phobos isn't using the Boost license for nothing. About the mess, as long as both libraries run on the same runtime, the problems should be confined to writing conversion function to convert the data types that differs between the two libraries. I don't think this is anything to worry about: those things happens all the time when you're using libraries from different sources. -- Michel Fortin michel.fortin@michelf.com http://michelf.com/ |
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michel Fortin | Michel Fortin:
>I don't think this is anything to worry about: those things happens all the time when you're using libraries from different sources.<
Thank you for your answer.
A little community of people writing for the same nearly unknown language two different standard libraries that share lot of functionality. I don't remember other uncommon (or even common) languages in this situation :-) Even if I can accept that there is no solution, I will never see this as something normal or sane :-)
Bye,
bearophile
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 04/27/2010 04:58 PM, bearophile wrote:
> Steven Schveighoffer:
>> I like what you've done. It's very similar to what was done in Tango. I
>> hate to ask this, but I just want to verify that you did not base your
>> code on Tango, especially since you have used Tango.
>
> In D2 the runtime of Phobos and Tango have being merged, so all D programmers can install both libs. So the two libs must have distinct contents.
> So I'm for removing the time module from Phobos, and keep only the Tango one. So this module is waste of time, and efforts have to be redirected in improving or rewriting the time module of Tango.
> Othrwise in D2 it will happen the same mess it's happend in D1, where you have two partially duplicated libs. All D2 programmers will want to install both libs, and they will not desire to choose what time lib to use. One time lit is enough.
I don't think anyone should have to install an extra library just to figure out what time it is.
-Lars
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Tue, Apr 27, 2010 at 12:12:36PM -0400, bearophile wrote: > A little community of people writing for the same nearly unknown language two different standard libraries that share lot of functionality. I don't remember other uncommon (or even common) languages in this situation :-) Even if I can accept that there is no solution, I will never see this as something normal or sane :-) I'm sure it happens all the time in uncommon languages, but you don't hear about them because they are uncommon! For a common language example, look no further than C. -- Adam D. Ruppe http://arsdnet.net |
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer さんは書きました: > On Tue, 27 Apr 2010 04:55:28 -0400, SHOO <zan77137@nifty.com> wrote: > >> Tango is great library for D1. I am Tango user and I am indebted to >> Tango well. But Tango has some probrems. >> >> - Tango's license is BSD lisence or AFL. This license is incompatible to >> Phobos's Boost license. >> - The specification is disregarded, for example Object.dispose and string. >> - Tango supports only D1 >> - In particular, deep regret is to have split resources of D into two >> halves. >> >> If possible, I want to migrate to D2. And I want to be separated from >> Tango. However, some functions are insufficient for Phobos compared with >> Tango. >> The std.date module is one of the list of dissatisfaction to Phobos. >> I summarize my (and some of Japanese users's) opinion following: >> >> - I want to handle it as another thing for the time and the time span. >> - I want a more structural class for time operating. >> - std.date is a bit buggy... >> >> By these reasons, I made std.time module as the first step of the >> contribution for Phobos. > > I like what you've done. It's very similar to what was done in Tango. I hate to ask this, but I just want to verify that you did not base your code on Tango, especially since you have used Tango. I was planning to implement a Time system for Tango that mimics Tango's design, if that is what you have done, I think that's perfectly legit. Basically, I want to verify that you rewrote all your implementation from scratch. I wrote it by own hand. But I referred to Tango, Phobos or some web site some interfaces and physical quantities(The thing which becomes the same quantity even if anyone calculates). Please point out the point where you noticed. > More comments: > > I'd like accessors for seconds/milliseconds/etc from Span. For integer? I dislike that precision is cut off. You can get seconds with a real number in interval, or calculate by ticks and TICKSPERSEC. > I'm not sure I like the Clocks structure. Why have a separate Span that is in terms of some arbitrary OS resolution? Can you give an example of why I'd want to use Clocks instead of Span? > > -Steve Clocks.TICKSPERSEC may have better precision than Span.TICKSPERSEC. Sacrificing precision in the middle of a calculation is MOTTAINAI. Clocks may be used for benchmarks or exact time measurement. |
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | Lars T. Kyllingstad:
> I don't think anyone should have to install an extra library just to figure out what time it is.
I agree. But months ago I have though that a basic&standard D2 installation will already contain both libs. I guess I was wrong.
Bye,
bearophile
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile $B$5$s$O=q$-$^$7$?(B:
> Steven Schveighoffer:
>> I like what you've done. It's very similar to what was done in Tango. I hate to ask this, but I just want to verify that you did not base your code on Tango, especially since you have used Tango.
>
> In D2 the runtime of Phobos and Tango have being merged, so all D programmers can install both libs. So the two libs must have distinct contents.
> So I'm for removing the time module from Phobos, and keep only the Tango one. So this module is waste of time, and efforts have to be redirected in improving or rewriting the time module of Tango.
> Othrwise in D2 it will happen the same mess it's happend in D1, where you have two partially duplicated libs. All D2 programmers will want to install both libs, and they will not desire to choose what time lib to use. One time lit is enough.
>
> Bye,
> bearophile
You are right. However, I cannot follow the most recent version of D as far as unfortunately I am going to use Tango.
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile $B$5$s$O=q$-$^$7$?(B:
> Lars T. Kyllingstad:
>> I don't think anyone should have to install an extra library just to figure out what time it is.
>
> I agree. But months ago I have though that a basic&standard D2 installation will already contain both libs. I guess I was wrong.
>
> Bye,
> bearophile
Really, if Tango had solved the license problem and been able to be used for D2, I would be happy.
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michel Fortin | Michel Fortin さんは書きました:
> On 2010-04-27 04:55:28 -0400, SHOO <zan77137@nifty.com> said:
>
>> By these reasons, I made std.time module as the first step of the
>> contribution for Phobos.
>
> Looks nice. I think defining structs as you did to handle date and time is the way to go.
>
> I've done something similar in the past to store dates and times which I like a lot. What I did was just a storage format, but templates allowed me to store dates and time spans with any precision while exposing always the same public API.
>
> I'm pasting my code below in case it can inspire you (note that this code predates the new operator overloading syntax), and feel free to use any of this under the Boost license if applicable.
In the code that I wrote, it can express Time until December 31, 9999. And, the precision of Span is 100 nanoseconds order.
About the precision, I think that it is necessary and sufficient condition.
But your idea is interesting. It seem to be more interesting if BigInt is combined.
|
April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | On Tue, 27 Apr 2010 12:32:44 -0400, SHOO <zan77137@nifty.com> wrote: > Steven Schveighoffer さんは書きました: >> On Tue, 27 Apr 2010 04:55:28 -0400, SHOO <zan77137@nifty.com> wrote: >> >>> Tango is great library for D1. I am Tango user and I am indebted to >>> Tango well. But Tango has some probrems. >>> >>> - Tango's license is BSD lisence or AFL. This license is incompatible to >>> Phobos's Boost license. >>> - The specification is disregarded, for example Object.dispose and string. >>> - Tango supports only D1 >>> - In particular, deep regret is to have split resources of D into two >>> halves. >>> >>> If possible, I want to migrate to D2. And I want to be separated from >>> Tango. However, some functions are insufficient for Phobos compared with >>> Tango. >>> The std.date module is one of the list of dissatisfaction to Phobos. >>> I summarize my (and some of Japanese users's) opinion following: >>> >>> - I want to handle it as another thing for the time and the time span. >>> - I want a more structural class for time operating. >>> - std.date is a bit buggy... >>> >>> By these reasons, I made std.time module as the first step of the >>> contribution for Phobos. >> I like what you've done. It's very similar to what was done in Tango. I hate to ask this, but I just want to verify that you did not base your code on Tango, especially since you have used Tango. I was planning to implement a Time system for Tango that mimics Tango's design, if that is what you have done, I think that's perfectly legit. Basically, I want to verify that you rewrote all your implementation from scratch. > > I wrote it by own hand. > But I referred to Tango, Phobos or some web site some interfaces and physical quantities(The thing which becomes the same quantity even if anyone calculates). > > Please point out the point where you noticed. If you wrote it by your own hand and only used interfaces for guidance, then I think it is free and clear from copyright issues. Thanks for clarifying! >> More comments: >> I'd like accessors for seconds/milliseconds/etc from Span. > > For integer? > I dislike that precision is cut off. > You can get seconds with a real number in interval, or calculate by ticks and TICKSPERSEC. The internal storage is via integer, so if for example the integer number of milliseconds is desired, doing the calculation via converting to a floating point, and then scaling/truncating is inefficient, subject to floating point error, and more convoluted than it has to be. I'd rather have an exact method that is as fast as possible, and is as simple as possible. It is not too much extra to add these methods (they are pretty much boilerplate code). Many existing C libraries and network protocols encode time via integers, so there is real need to be able to convert to these units, and to allow it with as little syntax as possible is good. >> I'm not sure I like the Clocks structure. Why have a separate Span that is in terms of some arbitrary OS resolution? Can you give an example of why I'd want to use Clocks instead of Span? >> -Steve > > Clocks.TICKSPERSEC may have better precision than Span.TICKSPERSEC. > Sacrificing precision in the middle of a calculation is MOTTAINAI. > Clocks may be used for benchmarks or exact time measurement. Ah, I didn't think that Clocks.TICKSPERSEC could have *better* resolution, that is a good benefit. Then all that is left is the name, Clocks is not a good name for a value type entity. It seems more suited for a static entity that contains clocks. You already have defined interval, so that is out. I can't think of anything good right now, but it definitely should not be a plural word. This is a very solid library, very little to complain about! One thing I would suggest if this is assimilated into druntime/phobos is that we split the Span functionality out into it's own module (or put it in object.di) so it can be used in druntime for things like Thread.sleep. -Steve |
Copyright © 1999-2021 by the D Language Foundation