[Mono-list] Native number types but not general number type?
Michael McGlothlin
mike.mcglothlin at gmail.com
Tue Feb 24 21:30:53 UTC 2015
With the addition of native number types I have returned to an old line of thought about why C# doesn't have a general Number type with other number types in some sort of hierarchy under it.
Obviously there are times when using a very specific number type is important for performance or compatibility but usually I don't really care. I probably don't care if the number is represented as 32 bits or 64 bits, if it's signed or not, if it is whole numbers or fractional, etc. So long as the behavior is correct when casting to a more specific type I'd rather it just work with the least amount of effort.
Likewise I'd like to more easily use lossless numbers of unlimited size, including fractional values, when needed and easy manipulation of numbers into different representations (such as byte order, different ways of storing the sign, etc). Something similar to changing text encodings.
A general number type seems it'd ease portability even more than native types. It was mentioned that Mono may push for these native types to made standard. Is there a technical reason a general number type couldn't be, or shouldn't be, introduced? Not asking anyone to actually doing it so much as trying to understand the problem.
Sent from my iPad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20150224/a750b081/attachment.html>
More information about the Mono-list
mailing list