April 11, 2011
spir:

> I'm trying to understand why people use tuples (outside multiple return values and variadic typetuples). Why do you prefere the above to:

Tuples are also sortable and printable on default, I think.

Bye,
bearophile
April 11, 2011
On 04/11/2011 10:10 AM, SimonM wrote:
> On 2011/04/11 09:31 AM, spir wrote:
>> On 04/11/2011 02:42 AM, bearophile wrote:
>>> I and Don have asked (in Bugzilla and elsewhere) to change the
>>> built-in names into sbyte and ubyte, to avoid the common confusions
>>> between signed and unsigned bytes in D, but Walter was deaf to this.
>>
>> I think a good naming scheme would be:
>>
>> * signed : int8 .. int64
>> * unsigned : nat8 .. nat64
>>
>> (since "natural number" more or less means "unsigned integer number")
>> already. What do you think?
> I like the idea of removing all the different integer type names (byte, short,
> int, long, cent) and replacing them with int8..int64 (I'd still prefer
> uint8..uint64 though).
>
> Then you could use just 'int' to specify using the current system's
> architecture (and hopefully replace the ugly size_t type). I also think it
> makes more sense to just use 'int' when you don't really care about the
> specific size of the value. Unfortunately it would break backwards compatility
> so it would never make it into D's current state.

Agreed. Same for uint or nat.
And no implicit cast, please ;-)

Denis
-- 
_________________
vita es estrany
spir.wikidot.com

April 11, 2011
No reason. Sometimes I find a new feature in D and I like to try it out in my code in various places, to see how it looks, how it works, etc. In this case a simple struct would do. :)
April 11, 2011
There are some aliases in std.stdint
April 11, 2011
bearophile Wrote:

> - C# uses sbytes, and ubytes. Enough said.

there's no ubyte in C#
It has byte, and it's unsigned.

http://msdn.microsoft.com/en-us/library/exx3b86w.aspx
April 11, 2011
Kagamin:

> bearophile Wrote:
> 
> > - C# uses sbytes, and ubytes. Enough said.
> 
> there's no ubyte in C#
> It has byte, and it's unsigned.
> 
> http://msdn.microsoft.com/en-us/library/exx3b86w.aspx

I was partially wrong, thank you. If you take a look it has int/unt, short/ushort, etc, but it doesn't have byte/ubyte, it has sbyte/byte. In my opinion here the naming symmetry has being broken because for most programmers bytes are unsigned. In D I have suggested sbyte/ubyte, but I accept the C# solution too.

Bye,
bearophile
1 2
Next ›   Last »