Jump to page: 1 2
Thread overview
std.experimental.safeint.d
Jun 08, 2015
Jacob Carlborg
Jun 08, 2015
Dmitry Olshansky
Jun 08, 2015
Jacob Carlborg
Jun 08, 2015
Dmitry Olshansky
Jun 08, 2015
Dmitry Olshansky
Jun 08, 2015
Walter Bright
June 07, 2015
SafeInt!T is an integer wrapper struct with an explicit NaN value build on top of core.checkedint.

Features:

* checks if assigned values can be actually stored
* for SafeInt!u(T) NaN is T.max
* for SafeInt!T NaN is T.min
* SafeInt!T.opBinary("+","-","%","*","/") return SafeInt!T
  if value can not be store by SafeInt!T returned value is SafeInt!T.nan
* should be pretty much a act as any (u)integer type

Additionally, the module contains safe ==,!=,<,<=,>,>= comparisons functions

assert(-1 == uint.max); // this is wrongfully true
assert(notEqual(-1, uint.max)); // this asserts correctly true
June 07, 2015
PR: https://github.com/D-Programming-Language/phobos/pull/3389
June 08, 2015
On 2015-06-07 22:27, Robert burner Schadek wrote:
> SafeInt!T is an integer wrapper struct with an explicit NaN value build
> on top of core.checkedint.

A completely new module should go through the review queue [1] and no pull request should be created until it's passed the review.

[1] http://wiki.dlang.org/Review_Queue

-- 
/Jacob Carlborg
June 08, 2015
On 6/7/2015 1:27 PM, Robert burner Schadek wrote:
> SafeInt!T is an integer wrapper struct with an explicit NaN value build on top
> of core.checkedint.

Bearophile ought to like this!
June 08, 2015
On Monday, 8 June 2015 at 06:43:59 UTC, Jacob Carlborg wrote:
> A completely new module should go through the review queue [1] and no pull request should be created until it's passed the review.

The part about the PR would be a first and quiet useless.

June 08, 2015
On 08-Jun-2015 09:44, Jacob Carlborg wrote:
> On 2015-06-07 22:27, Robert burner Schadek wrote:
>> SafeInt!T is an integer wrapper struct with an explicit NaN value build
>> on top of core.checkedint.
>
> A completely new module should go through the review queue [1] and no
> pull request should be created until it's passed the review.
>
> [1] http://wiki.dlang.org/Review_Queue
>

Actually it became quite common to present it as a pull request along with documentation (where's DDoc, Robert?). It makes commenting on code a breeze. Plus re-use of auto-tester - author has more time to fix his stuff should something not work on some platform.

OT: I'm not quite sold on std.experimental as it 100% certain to be a breaking change once a module is promoted to std proper or phased out for that matter. And, of course, updating anything in std.experimental module is going to be a long tedious string of pull requests.

-- 
Dmitry Olshansky
June 08, 2015
On 2015-06-08 12:33, Dmitry Olshansky wrote:

> Actually it became quite common to present it as a pull request along
> with documentation (where's DDoc, Robert?).

Yeah, I've noticed.

> It makes commenting on code
> a breeze. Plus re-use of auto-tester - author has more time to fix his
> stuff should something not work on some platform.

It's possible to comment on any commit on GitHub. You don't need a pull request for that.

-- 
/Jacob Carlborg
June 08, 2015
On 6/8/15 6:33 AM, Dmitry Olshansky wrote:

> OT: I'm not quite sold on std.experimental as it 100% certain to be a
> breaking change once a module is promoted to std proper or phased out
> for that matter.

That's the point of it. "If you use this, your code may break."

> And, of course, updating anything in std.experimental
> module is going to be a long tedious string of pull requests.
>

How so?

-Steve
June 08, 2015
On Monday, 8 June 2015 at 10:33:12 UTC, Dmitry Olshansky wrote:
> along with documentation (where's DDoc, Robert?).

http://burner.github.io/phobos/phobos-prerelease/std_experimental_safeint.html
June 08, 2015
On 08-Jun-2015 16:36, Steven Schveighoffer wrote:
> On 6/8/15 6:33 AM, Dmitry Olshansky wrote:
>
>> OT: I'm not quite sold on std.experimental as it 100% certain to be a
>> breaking change once a module is promoted to std proper or phased out
>> for that matter.
>
> That's the point of it. "If you use this, your code may break."

Okay.

>> And, of course, updating anything in std.experimental
>> module is going to be a long tedious string of pull requests.
>>
>
> How so?

Compared to just featuring the code on dub repository:
a) Release cycle tied to dmd
b) All changes must be reviewed
c) Changes got to be small enough to not require long review

Thus overhauls of internals are not going to be easily deliverable,
nor bug-fixes can be got out of band with D distribution.

If anything I'd love to see more 3-rd party stuff that is easily installable.

-- 
Dmitry Olshansky
« First   ‹ Prev
1 2