Re: RFC: Units of measurement for D (Phobos?)

2016-03-30 Thread Nordlöw via Digitalmars-d
On Tuesday, 29 March 2016 at 12:46:44 UTC, Seb wrote: So @nordlow how about pushing this code to a separate repository and dub? Here you are: https://github.com/nordlow/units-d

Re: RFC: Units of measurement for D (Phobos?)

2016-03-29 Thread Seb via Digitalmars-d
On Tuesday, 22 March 2016 at 09:55:28 UTC, Zardoz wrote: Impressive! I like the idea, in special when you can handled derived units and doing conversions like this : convert!(kilo(newton))(200 * gram * meter / pow!2(second))); Wow that's pretty sweet! So @nordlow how about pushing this

Re: RFC: Units of measurement for D (Phobos?)

2016-03-22 Thread Zardoz via Digitalmars-d
On Tuesday, 12 April 2011 at 16:44:10 UTC, David Nadlinger wrote: Recently, I have been playing around with a little units of measurement system in D. As this topic has already been brought up quite a number of times here, I thought I would put my implementation up for discussion here. When

Re: RFC: Units of measurement for D (Phobos?)

2016-03-20 Thread ZombineDev via Digitalmars-d
On Wednesday, 16 March 2016 at 13:39:48 UTC, Nordlöw wrote: On Wednesday, 16 March 2016 at 11:28:05 UTC, Nordlöw wrote: I'm working on these issues right now. Regularly updated here: https://github.com/nordlow/justd/blob/master/units.d https://github.com/nordlow/justd/blob/master/si.d BTW,

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread David Nadlinger via Digitalmars-d
On Wednesday, 16 March 2016 at 17:12:42 UTC, ZombineDev wrote: Sometimes a more gradual approach may be useful: […] How would this be any more than an informational annotation? If anything, you could build a custom lint tool to propagate and verify the unit annotations, but I don't quite

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Thursday, 17 March 2016 at 12:51:28 UTC, Nordlöw wrote: I believe `isConvertableTo` is a more Phobos-compliant naming, right? Correction: Should be named `isConvertibleTo`. BTW: We already have https://dlang.org/phobos/std_traits.html#isImplicitlyConvertible Why don't we already have

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 11:28:05 UTC, Nordlöw wrote: I'm working on these issues right now. Regularly updated here: https://github.com/nordlow/justd/blob/master/units.d https://github.com/nordlow/justd/blob/master/si.d

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 02:03:09 UTC, David Nadlinger wrote: The code was written in a dark age where CTFE bugs were very common (e.g. trying to use std.algorithm.sort would give weird results), there was a number of issues with template parameters, and many relevant features simply did

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread David Nadlinger via Digitalmars-d
On Wednesday, 16 March 2016 at 22:16:20 UTC, Nordlöw wrote: How should then sin, cos, tan, expi be redesigned to support `ScaledUnit` aswell as `Quantity`? What you can do is to take an arbitrary quantity with an (angle.canConvert!radian) template constraint. Inside the function, you then

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 22:34:04 UTC, David Nadlinger wrote: What you can do is to take an arbitrary quantity with an (angle.canConvert!radian) template constraint. Inside the I believe `isConvertableTo` is a more Phobos-compliant naming, right? Is there are reason why `convert`

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Andrei Alexandrescu via Digitalmars-d
On 3/16/16 7:19 AM, Nordlöw wrote: On Wednesday, 16 March 2016 at 13:57:51 UTC, ZombineDev wrote: BTW, is there overlap between a unit system library and Andrei's BigO system? Maybe it would be useful if the later can be expressed with the former. Interesting. Could you elaborate? What units

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 02:03:09 UTC, David Nadlinger wrote: Please make a really, really thorough pass through the source before proposing it for Phobos. Thanks! I'm working on these issues right now.

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread David Nadlinger via Digitalmars-d
Hi Per, Many thanks for working on the code! Could you put it up as a separate Dub package to make it easier for people to try out? `justd` is an 68 MiB-heavy clone, which makes it somewhat cumbersome to play around with and contribute to it. You'd probably also want to add your name to the

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread ZombineDev via Digitalmars-d
On Wednesday, 16 March 2016 at 14:19:56 UTC, Nordlöw wrote: On Wednesday, 16 March 2016 at 13:57:51 UTC, ZombineDev wrote: BTW, is there overlap between a unit system library and Andrei's BigO system? Maybe it would be useful if the later can be expressed with the former. Interesting. Could

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 17:46:39 UTC, David Nadlinger wrote: Hi Per, Many thanks for working on the code! Could you put it up as a separate Dub package to make it easier for people to try out? Ok, I'll do that in a couple of days. In the mean while could you take a look at the

Re: RFC: Units of measurement for D (Phobos?)

2016-03-19 Thread Nordlöw via Digitalmars-d
On Wednesday, 16 March 2016 at 13:57:51 UTC, ZombineDev wrote: BTW, is there overlap between a unit system library and Andrei's BigO system? Maybe it would be useful if the later can be expressed with the former. Interesting. Could you elaborate? What units should be involved? Andralex?

Re: RFC: Units of measurement for D (Phobos?)

2016-03-18 Thread David Nadlinger via Digitalmars-d
On Thursday, 17 March 2016 at 12:51:28 UTC, Nordlöw wrote: I believe `isConvertableTo` is a more Phobos-compliant naming, right? I went for canConvert since it is a bit shorter than isConvertible and there is precedent for it in Phobos as well (e.g. find/canFind). It's a matter of taste,

Re: RFC: Units of measurement for D (Phobos?)

2016-03-18 Thread Nordlöw via Digitalmars-d
On Thursday, 17 March 2016 at 12:55:39 Ping, David Nadlinger! 

Re: RFC: Units of measurement for D (Phobos?)

2016-03-16 Thread deed via Digitalmars-d
On Monday, 14 March 2016 at 09:04:28 UTC, Nordlöw wrote: Could somebody point out if something is missing in David's solution. And, if so, which parts of biozic's which could be reused. that could/should be reused for filling in these gaps. Last time I evaluated these modules, I recall

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread David Nadlinger via Digitalmars-d
On Tuesday, 15 March 2016 at 09:07:05 UTC, Nordlöw wrote: On Monday, 14 March 2016 at 18:51:45 UTC, Chris Wright wrote: Ohm my, that's awesome. Watt needs to happen to get this into Phobos? I'm cleaning up David's work right and will put up a PR today. Please make a really, really thorough

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread David Nadlinger via Digitalmars-d
On Tuesday, 15 March 2016 at 14:46:30 UTC, D.Enguiyen wrote: Is it able to manage quantities with a non-linear transformations, for example when dealing with octet and byte ? (1024)!"byte" == 1!"kbyte"; There are no non-linear transformations going on here, following usual math terminology.

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread David Nadlinger via Digitalmars-d
On Monday, 14 March 2016 at 19:08:18 UTC, Robert burner Schadek wrote: have a look at this! https://github.com/biozic/quantities This has been brought up (and subsequently discussed) on the first page of this thread, more than two years ago. — David

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Robert burner Schadek via Digitalmars-d
On Tuesday, 15 March 2016 at 09:08:11 UTC, Nordlöw wrote: On Monday, 14 March 2016 at 19:08:18 UTC, Robert burner Schadek wrote: have a look at this! https://github.com/biozic/quantities Could you briefly outline why you prefer this over David's work? - has been in code.dlang.org since

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Andrei Alexandrescu via Digitalmars-d
On 3/15/16 3:31 AM, Marc Schütz wrote: For some other modules, Andrei has insisted that package.d must publicly import all subpackages Not too strongly, I think std.allocator doesn't do that. But the judgment must be thoroughly sound and explained. For the putative package, importing

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread D.Enguiyen via Digitalmars-d
On Tuesday, 15 March 2016 at 14:46:30 UTC, D.Enguiyen wrote: Is it able to manage quantities with a non-linear transformations, for example when dealing with octet and byte ? (1024)!"byte" == 1!"kbyte"; 1!"byte" * 1024 == 1!"kbyte";

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread D.Enguiyen via Digitalmars-d
On Tuesday, 15 March 2016 at 14:50:42 UTC, D.Enguiyen wrote: On Tuesday, 15 March 2016 at 14:46:30 UTC, D.Enguiyen wrote: Is it able to manage quantities with a non-linear transformations, for example when dealing with octet and byte ? (1024)!"byte" == 1!"kbyte"; 1!"byte" * 1024 ==

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread D.Enguiyen via Digitalmars-d
On Tuesday, 15 March 2016 at 09:13:10 UTC, Nordlöw wrote: On Monday, 14 March 2016 at 09:04:28 UTC, Nordlöw wrote: http://klickverbot.at/code/units/std_units.html http://klickverbot.at/code/units/std_units.html#PrefixSystem No module name in Phobos is currently in plural form. I suggest we

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Marc Schütz via Digitalmars-d
On Tuesday, 15 March 2016 at 09:13:10 UTC, Nordlöw wrote: On Monday, 14 March 2016 at 09:04:28 UTC, Nordlöw wrote: http://klickverbot.at/code/units/std_units.html http://klickverbot.at/code/units/std_units.html#PrefixSystem No module name in Phobos is currently in plural form. std.traits

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 09:04:28 UTC, Nordlöw wrote: http://klickverbot.at/code/units/std_units.html http://klickverbot.at/code/units/std_units.html#PrefixSystem No module name in Phobos is currently in plural form. I suggest we stick to that standard a name these std.experimental.unit

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 19:08:18 UTC, Robert burner Schadek wrote: have a look at this! https://github.com/biozic/quantities Could you briefly outline why you prefer this over David's work?

Re: RFC: Units of measurement for D (Phobos?)

2016-03-15 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 18:51:45 UTC, Chris Wright wrote: Ohm my, that's awesome. Watt needs to happen to get this into Phobos? I'm cleaning up David's work right and will put up a PR today.

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Robert burner Schadek via Digitalmars-d
have a look at this! https://github.com/biozic/quantities

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Chris Wright via Digitalmars-d
On Mon, 14 Mar 2016 09:04:28 +, Nordlöw wrote: > I've gained time and energy to take up this task again. It seems like > David Nadlinger's solution is very complete: > > https://github.com/klickverbot/phobos/tree/undefined > > http://klickverbot.at/code/units/std_si.html Ohm my, that's

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 09:37:10 UTC, Nordlöw wrote: One more thing: Angular units: I suggest non-SI-derived units for `Radian` and `Steradian` instead. Then, degrees and other derived angular units shall be expressed as scaled versions of these. Oops, already defined here:

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 09:10:21 UTC, Nordlöw wrote: http://klickverbot.at/code/units/std_si.html One more thing: Angular units: I suggest non-SI-derived units for `Radian` and `Steradian` instead. Then, degrees and other derived angular units shall be expressed as scaled versions of

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Nordlöw via Digitalmars-d
On Monday, 14 March 2016 at 09:04:28 UTC, Nordlöw wrote: http://klickverbot.at/code/units/std_units.html#PrefixSystem Should be: http://klickverbot.at/code/units/std_si.html

Re: RFC: Units of measurement for D (Phobos?)

2016-03-14 Thread Nordlöw via Digitalmars-d
On Thursday, 10 September 2015 at 07:01:19 UTC, David Nadlinger wrote: You must be confusing the library with something else (or me with another David). I'm pretty sure that my original proof-of-concept is the most flexible of all of them, coming with support for composing arbitrary runtime

Re: RFC: Units of measurement for D (Phobos?)

2015-09-10 Thread David Nadlinger via Digitalmars-d
On Wednesday, 9 September 2015 at 15:21:22 UTC, HaraldZealot wrote: One big problem is, that in SI base unit for mass is kilogram not gram. This is definitely not a "big problem". There is nothing that sets apart the "base" units in my old library from any other units, except for the fact

Re: RFC: Units of measurement for D (Phobos?)

2015-09-10 Thread David Nadlinger via Digitalmars-d
On Wednesday, 9 September 2015 at 07:04:05 UTC, Per Nordlöw wrote: - David's library and quantities use different interal representation. Davids 7-dimensional vector of rational integers (a la Boost) is hardcoded to represent SI units. You must be confusing the library with something else (or

Re: RFC: Units of measurement for D (Phobos?)

2015-09-09 Thread via Digitalmars-d
On Tuesday, 12 April 2011 at 16:44:10 UTC, David Nadlinger wrote: Recently, I have been playing around with a little units of measurement system in D. As this topic has already been brought up quite a number of times here, I thought I would put my implementation up for discussion here. I

Re: RFC: Units of measurement for D (Phobos?)

2015-09-09 Thread HaraldZealot via Digitalmars-d
On Tuesday, 12 April 2011 at 16:44:10 UTC, David Nadlinger wrote: Recently, I have been playing around with a little units of measurement system in D. As this topic has already been brought up quite a number of times here, I thought I would put my implementation up for discussion here. ...

Re: RFC: Units of measurement for D (Phobos?)

2015-09-09 Thread Robert burner Schadek via Digitalmars-d
On Wednesday, 9 September 2015 at 07:04:05 UTC, Per Nordlöw wrote: Which direction should we choose? quantities

Re: RFC: Units of measurement for D (Phobos?)

2014-03-04 Thread Nicolas Sicard
On Wednesday, 26 February 2014 at 22:49:57 UTC, Nordlöw wrote: On Wednesday, 26 February 2014 at 21:41:57 UTC, Kelet wrote: Tangentially related: https://github.com/biozic/quantities Impressive! This seems similar to David Nadlingers std.units and std.si. When will all these efforts on

Re: RFC: Units of measurement for D (Phobos?)

2014-03-04 Thread Nordlöw
Thanks! I think David Nadlingers' is more elaborate (scaled and affine units) and less prone to rounding errors. I haven't used it yet. Mine is more basic but has a parsing system that I use to So you cannot defined things lika kPa from Pa in compile-time? define units quickly at

Re: RFC: Units of measurement for D (Phobos?)

2014-03-04 Thread Nicolas Sicard
On Tuesday, 4 March 2014 at 13:20:02 UTC, Nordlöw wrote: Thanks! I think David Nadlingers' is more elaborate (scaled and affine units) and less prone to rounding errors. I haven't used it yet. Mine is more basic but has a parsing system that I use to So you cannot defined things lika kPa from

Re: RFC: Units of measurement for D (Phobos?)

2014-02-26 Thread Nordlöw
Is somebody waiting for this to be reviewed? /Per

Re: RFC: Units of measurement for D (Phobos?)

2014-02-26 Thread Kelet
Tangentially related: https://github.com/biozic/quantities

Re: RFC: Units of measurement for D (Phobos?)

2014-02-26 Thread Nordlöw
On Wednesday, 26 February 2014 at 21:41:57 UTC, Kelet wrote: Tangentially related: https://github.com/biozic/quantities Impressive! This seems similar to David Nadlingers std.units and std.si. When will all these efforts on implementing Units/SI be synchronized and reviewed? One question:

Re: RFC: Units of measurement for D (Phobos?)

2014-02-26 Thread Michael
enum radian = meter / meter; // ditto enum steradian = square(meter) / square(meter); /// ditto What on earth does this mean? It has to do with the definition of radian itself. If you draw a circle (of any radius) around an angle. The measure of the angle is radian is the ratio between the

Re: RFC: Units of measurement for D (Phobos?)

2011-04-16 Thread David Nadlinger
On 4/12/11 6:40 PM, David Nadlinger wrote: - The helper functions for creating instances of new unit types (scale, affine, ...) are currently template functions taking an instance of the unit they manipulate as actual argument. This is only for »historical« reasons really, would it be cleaner to

RFC: Units of measurement for D (Phobos?)

2011-04-12 Thread David Nadlinger
Recently, I have been playing around with a little units of measurement system in D. As this topic has already been brought up quite a number of times here, I thought I would put my implementation up for discussion here. When this topic came up previously, it has been proposed to include