Re: Units of Measurement Library: units-d

2016-04-04 Thread Simen Kjaeraas via Digitalmars-d-announce
On Saturday, 2 April 2016 at 01:19:45 UTC, Meta wrote: What is needed is Lisp's gensym construct. That's basically what I said, no? :p One problem of lisp's gensym (if we were to use it in D) is that it's simply a monotonically increasing number with a global prefix. It's perfect for the

Re: Units of Measurement Library: units-d

2016-04-02 Thread crimaniak via Digitalmars-d-announce
On Friday, 1 April 2016 at 22:54:53 UTC, Simen Kjaeraas wrote: ... I kinda agree. And looking at https://dlang.org/spec/traits.html, I see there's __MODULE__, which would probably be a better choice than __FILE__. I think adding something like __UNIQUE_NAME__ to predefined constants will

Re: Units of Measurement Library: units-d

2016-04-01 Thread Meta via Digitalmars-d-announce
On Friday, 1 April 2016 at 22:54:53 UTC, Simen Kjaeraas wrote: On Friday, 1 April 2016 at 21:46:35 UTC, ag0aep6g wrote: On 01.04.2016 22:59, Simen Kjaeraas wrote: The usual way to fix it would be to include __FILE__ and __LINE__ in the template arguments: Right, no mixin this way. I

Re: Units of Measurement Library: units-d

2016-04-01 Thread Simen Kjaeraas via Digitalmars-d-announce
On Friday, 1 April 2016 at 21:46:35 UTC, ag0aep6g wrote: On 01.04.2016 22:59, Simen Kjaeraas wrote: The usual way to fix it would be to include __FILE__ and __LINE__ in the template arguments: Right, no mixin this way. I wouldn't call this "truly nice", though. It depends on code

Re: Units of Measurement Library: units-d

2016-04-01 Thread ag0aep6g via Digitalmars-d-announce
On 01.04.2016 22:59, Simen Kjaeraas wrote: The usual way to fix it would be to include __FILE__ and __LINE__ in the template arguments: Right, no mixin this way. I wouldn't call this "truly nice", though. It depends on code formatting to work. Put everything on one line and it breaks.

Re: Units of Measurement Library: units-d

2016-04-01 Thread Simen Kjaeraas via Digitalmars-d-announce
On Friday, 1 April 2016 at 19:03:03 UTC, ag0aep6g wrote: I dislike that the type depends only on the given name. This effectively means that the names are in a global namespace. [snip] I can't think of a truly nice way to accomplish this, though. As far as I see, it needs a mixin of some kind.

Re: Units of Measurement Library: units-d

2016-04-01 Thread Jack Stouffer via Digitalmars-d-announce
On Thursday, 31 March 2016 at 23:58:54 UTC, Nordlöw wrote: I've put David Nadlinger work together with my tweaks on top at https://github.com/nordlow/units-d to make it easier to experiment with. PR are very welcome. Nice work. I have yet to play around with it, but this is definitely

Re: Units of Measurement Library: units-d

2016-04-01 Thread ag0aep6g via Digitalmars-d-announce
On 01.04.2016 01:58, Nordlöw wrote: https://github.com/nordlow/units-d From there: * Example: * --- * alias BaseUnit!("Ampere", "A") Ampere; * enum ampere = Ampere.init; * // or * enum ampere = baseUnit!("Ampere", "A"); * --- I dislike that the type depends only on the given name.

Units of Measurement Library: units-d

2016-03-31 Thread Nordlöw via Digitalmars-d-announce
I've put David Nadlinger work together with my tweaks on top at https://github.com/nordlow/units-d to make it easier to experiment with. PR are very welcome.