Initial feedback for std.experimental.image

ponce via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 6 08:34:34 PDT 2015


On Monday, 6 July 2015 at 13:48:53 UTC, Rikki Cattermole wrote:
> If reviewing the code itself is too much of a hassel, please 
> review the specification document. 
> http://cattermole.co.nz/phobosImage/docs/html/std_experimental_image_specification.html
>


> Use the Cartesian coordinates system using two (X and Y) size_t 
> integers

Why not just int? There is preciously little addressable images 
beyond 2^31. size_t has a variable size and is a source of build 
breaking.
Also, please no unsigned integers! This create all manners of 
bugs because of how integer promotion work.


> A major concern for D is templated code. Template bloat as it 
> is known is when there is large amounts of templates being 
> initiated with vast array of compile time arguments. For this 
> very reason, template usage must be constrained to the bare 
> minimum. Keeping in line with other D code of highly reusable 
> code, templates will be used. Be constrained to colors (usage 
> not definition) and constructors as much as possible.

I don't think there is so much problems with Phobos levels of 
meta-programming. There are also way to reduce template 
instantiation with type-punning.

To me an image library should be based on a static interface with 
optionally a wrapper to auto-generate the dynamic interface much 
like in std.allocator. Is it the case? Your library seem to be 
based around the dynamic 'interface' instead.




More information about the Digitalmars-d mailing list