January 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9286



--- Comment #9 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-01-09 04:12:00 PST ---
> I believe the set of operations is unique. But I would need to try it out. Do you happen to know of an example that supports the set of integral oprations yet is no integral?

Floating point types support exactly the same set of operations as integral types but with slightly different semantics. So, there's no way to test a type's API for being an integral type without floating point types matching as well. Also, would types like core.time.Duration or core.time.TickDuration count as integral types? Both of them support those operations, and yet I wouldn't consider them to be integral types.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9286



--- Comment #10 from jens.k.mueller@gmx.de 2013-01-09 06:03:30 PST ---
(In reply to comment #9)
> > I believe the set of operations is unique. But I would need to try it out. Do you happen to know of an example that supports the set of integral oprations yet is no integral?
> 
> Floating point types support exactly the same set of operations as integral types but with slightly different semantics. So, there's no way to test a type's API for being an integral type without floating point types matching as well.

True. Floating point types shouldn't be counted as integral. Then let's check
for these semantics.
What about 1 / T.max == 0?
Admittedly this requires CTFE of your type.
You're right that you may also need to consider the semantics of the
operations.

> Also, would types like core.time.Duration or core.time.TickDuration count as integral types? Both of them support those operations, and yet I wouldn't consider them to be integral types.

No, since division must return a T. But a duration needs to loose its unit when dividing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »