std.experimental.checkedint is ready for comments!

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 15 17:31:38 PDT 2016


On 06/15/2016 02:50 PM, tsbockman wrote:
> On Wednesday, 15 June 2016 at 16:40:19 UTC, Andrei Alexandrescu wrote:
>> I think there are a few considerable issues with the proposal, but
>> also that all are fixable.
>
> I already sent a much longer message detailing some of the reasons why I
> believe my design is sensible. But, before we continue this discussion
> much further, I need to stop and make one thing clear:
>
> What you are proposing is *not* "fixing" my design - it is basically
> scrapping it and replacing it with a ground-up rewrite, with perhaps
> some bits and pieces and general inspiration taken from my work.

I'd say that's a fair assessment on the face of it. But the pieces are 
there and the grit and expertise to assemble them are already there. The 
real question is what's the "right" design. Ideally we should optimize 
for that.

> I'm OK with the community rejecting my design if that's what people
> really want to do, but I will not be implementing your proposal myself.
> I will simply leave `checkedint` on DUB, and move on with my life.

That is sensible, and a course of action I thought would transpire. But 
I suggest you to reconsider. Your PR is a solid implementation of the 
wrong idea. Before anyone gets offended, let me add that I think there's 
a lot of good in that. For this kind of work (not algorithm-intensive) 
ideas are cheap; the solid implementation matters a lot more than the 
idea - the same expertise can be put to use on another idea.

I tried to offer a careful review by a competent peer, with an eye for 
taking an okay design toward a great design. The kind of review I wish 
to get now as much as at any point of my career. They are difficult to 
receive but often have a lot of potential in them.

> So, I'm putting out a general call now for the community to download the
> DUB package, try actually *using* it for something, and speak up as to
> whether the design seems good, or not.
>
> If the decision is made to accept the high-level design, then we can go
> back to bikeshedding about names, fixing typos, tweaking/trimming the
> API, etc.

I don't think checkedint in a form close to its current one is for 
Phobos. I would argue it's not for D. Starting with the problem 
statement "we want to check integral operations for overflow and other 
surprising behaviors" and ending with 4.5 KLOC defining a bunch of names 
in 6 modules makes it highly suspicious there is an overgrown underbelly 
somewhere. The language features are not orchestrated properly. Even if 
it were the case that there's no smaller design that conforms with the 
requirements, that means requirements have a problem.


Andrei



More information about the Digitalmars-d mailing list