RFC: Units of measurement for D (Phobos?)

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 16 10:46:39 PDT 2016


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 Authors list.

On Wednesday, 16 March 2016 at 14:27:16 UTC, Nordlöw wrote:
>>  - UFCS (!)
> Done

There might be additional design possibilities now that didn't 
previously exist. The way of constructing a quantity is one such 
example, although I still like the approach using `*`.

>>  - UDAs
> Could you elaborate on possible usage in this case?

For example, to replace SuperSecretAliasToMarkThisAsUnit. It 
could conceivably also be used for the extra metadata like the 
base linear unit for affine units, etc.

>>  - Extracting template symbol/arguments from template instances
> Could you elaborate on possible usage in this case?

IIRC there are various `isXyz` templates where I went with a duck 
typing approach out of necessity (which might or might not be a 
better design choice than just checking for a certain template 
instance).

>>  - Eponymous templates with extra members
> Could you elaborate on possible usage in this case?

The code in and around GetConversion can probably be simplified. 
It currently explicitly uses `.Result` members and so on.

Another thing I forgot to mention in the previous post are 
documented unit tests. Pretty much all of the example blocks 
should probably be converted to it. The CTFE-related code could 
also use a closer look, for example makeIndexCtfe() is probably 
not needed any longer.

Best,
David


More information about the Digitalmars-d mailing list