Thread overview | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 10, 2005 [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Here is the full list of my suggested type aliases for D: TYPE ALIAS // RANGE void // void Integer: (std.stdint) byte int8_t // 8-bit signed ubyte uint8_t // 8-bit unsigned (0x00-0xFF) short int16_t // 16-bit signed ushort uint16_t // 16-bit unsigned (0x0000-0xFFFF) int int32_t // 32-bit signed uint uint32_t // 32-bit unsigned (0x00000000-0xFFFFFFFF) long int64_t // 64-bit signed (could be two int registers) ulong uint64_t // 64-bit unsigned (could be two uint registers) cent int128_t // 128-bit signed (reserved for future use) ucent uint128_t // 128-bit unsigned (reserved for future use) Character: (std.stdutf) char utf8_t // UTF-8 \x00-\x7F (ASCII) wchar utf16_t // UTF-16 \u0000-\uD7FF, \uE000-\uFFFF dchar utf32_t // UTF-32 \U00000000-\U0010FFFF (Unicode) Boolean: (std.stdbool) bit bool // false (0) | true (1) byte wbool // false (zero) | true (non-zero) int dbool // false (zero) | true (non-zero) String: (std.stdstr) char[] str // UTF-8, optimized for US-ASCII wchar[] wstr // UTF-16, optimized for Unicode dchar[] dstr // UTF-32, easy codepoint access Floating Point: float // 32-bit single precision (about 6 digits) double // 64-bit double precision (about 15 digits) real // 64/80/128-bit extended precision (platform) ifloat // \ idouble // imaginary versions of the above ireal // / cfloat // \ cdouble // complex (both real and imaginary parts) creal // / No new keywords, just a bunch of useful (?) aliases... --anders Implementation: (Public Domain) > module std.stdutf; > > /* UTF code units */ > > alias char utf8_t; // UTF-8 > alias wchar utf16_t; // UTF-16 > alias dchar utf32_t; // UTF-32 > module std.stdbool; > > /* boolean types */ > > alias bit bool; // boolean (true/false) > alias byte wbool; // wide boolean (like wchar) > alias int dbool; // double boolean (like dchar) > module std.stdstr; > > /* string types */ > > alias char[] str; // ASCII-optimized > alias wchar[] wstr; // Unicode-optimized > alias dchar[] dstr; // codepoint-optimized std.stdint already done, by Walter. |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote: > ireal // / > creal // / [ I don't really expect this rant to be taken serious by anyone, but sorry, I just cannot be silent about the issue... ] Warming up the old topic once again: I still think these two names are absolutely ridiculous. Mathematically speaking, 'imaginary' is the exact opposite of 'real', so talking of a 'ireal' which translates to "imaginary real" is a perfect oxymoron. 'complex' on the other hand is a sum of a 'real' and an 'imaginary' number, so 'creal' is another strange construction leading to the suspicion that the creator of the word never really worked with complex mathematics personally. To make it short, the names 'creal' and 'ireal' will simply lead anyone with some background in mathematics laugh out loud and lead him to refuse taking D serious. My suggestion would still be the old one: rename 'creal' to 'complex' and 'ireal' to 'imaginary' (the latter is hardly ever used explicitely, so the long name won't matter) The old excusion 'Everyone is free to use aliases' does not count here. The language specs sets standards that people will follow. If every library defines their own aliases, confusion will be complete. It they don't that means, that I have to real 'creal' and 'ireal' when I read docs or code written by other people which will simply hurt my eyes. (The names 'cfloat' and 'cdouble' don't matter too much, since they don't contain any internal contradiction) |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | Norbert Nemec wrote:
> [ I don't really expect this rant to be taken serious by anyone, but sorry,
> I just cannot be silent about the issue... ]
>
> Warming up the old topic once again:
>
> I still think these two names are absolutely ridiculous. Mathematically
> speaking, 'imaginary' is the exact opposite of 'real', so talking of a
> 'ireal' which translates to "imaginary real" is a perfect oxymoron.
I agree with you completely, it was hard to write that type table and
not notice the total weirdness of "creal is made of real and imaginary"
Even the old name of "extended" was better than the current one: "real".
I'm just glad that my platform of choice doesn't support them anyway, so
I might as well use the regular doubles. But a pity for the rest of you.
But if it was changed once, it could be changed again - right ? :-P
--anders
|
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | In article <cugjt3$8f$1@digitaldaemon.com>, Norbert Nemec says... >To make it short, the names 'creal' and 'ireal' will simply lead anyone with some background in mathematics laugh out loud and lead him to refuse taking D serious. I vote they should be called 'unreal' and 'surreal' instead :~) |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | I've used a fair amount of complex math during electronics courses. Now that you mention it, I have to agree with you. I can kind of understand how this happened, though. If I'm not mistaken the "real" in mathematics and the "real" in computer science haven't always been exactly analagous. So the oxymoron that surfaced from the merging of the two was probably accidental and, perhaps, only starkly obvious to a mathematician. I can see a mathematics guy coming along and gasping in horror at the site. Others, I'm sure, have looked at this with mild indifference.
Nonetheless, your point is valid. We don't want to scare away the math people!
- John R.
Norbert Nemec wrote:
> Anders F Björklund wrote:
>
>
>> ireal // /
>
>
>> creal // /
>
>
> [ I don't really expect this rant to be taken serious by anyone, but sorry,
> I just cannot be silent about the issue... ]
>
> Warming up the old topic once again:
>
> I still think these two names are absolutely ridiculous. Mathematically
> speaking, 'imaginary' is the exact opposite of 'real', so talking of a
> 'ireal' which translates to "imaginary real" is a perfect oxymoron.
>
> 'complex' on the other hand is a sum of a 'real' and an 'imaginary' number,
> so 'creal' is another strange construction leading to the suspicion that
> the creator of the word never really worked with complex mathematics
> personally.
>
> To make it short, the names 'creal' and 'ireal' will simply lead anyone with
> some background in mathematics laugh out loud and lead him to refuse taking
> D serious.
>
> My suggestion would still be the old one: rename 'creal' to 'complex' and
> 'ireal' to 'imaginary' (the latter is hardly ever used explicitely, so the
> long name won't matter)
>
> The old excusion 'Everyone is free to use aliases' does not count here. The
> language specs sets standards that people will follow. If every library
> defines their own aliases, confusion will be complete. It they don't that
> means, that I have to real 'creal' and 'ireal' when I read docs or code
> written by other people which will simply hurt my eyes.
>
> (The names 'cfloat' and 'cdouble' don't matter too much, since they don't
> contain any internal contradiction)
>
|
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Reimer | John Reimer wrote: > I've used a fair amount of complex math during electronics courses. Now that you mention it, I have to agree with you. I can kind of understand how this happened, though. If I'm not mistaken the "real" in mathematics and the "real" in computer science haven't always been exactly analagous. http://en.wikipedia.org/wiki/Real_number says: > In mathematics, the real numbers are intuitively defined as numbers that > are in one-to-one correspondence with the points on an infinite line—the > number line. The term "real number" is a retronym coined in response to > "imaginary number". Both float and double are equally "real numbers" too. Q for Walter: Why really was the old name of "extended" abandoned ? It fits well with single (float), double, extended precision to me. iextended and cextended might not be the shortest, but they are not as silly as "imaginary real" (ireal). Just a thought. Tue, 21 Jan 2003 "Walter" <walter@digitalmars.com> writes: > I've never particularly liked the 'extended' keyword for 80 bit floats, and > there is a lot of interest in complex floats and complex doubles. So, I'm > thinking of renaming and adding a few types: > > extended = no longer a keyword > real = 80 bit floating point > cfloat = complex float > cdouble = complex double > creal = complex real > ifloat = imaginary float > idouble = imaginary double > ireal = imaginary real > > This would be consistent with the way 'u' is used as a prefix for unsigned. > > Any thoughts? Objections? Flames <g>? http://www.digitalmars.com/d/archives/10261.html --anders |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | Norbert Nemec wrote: > Warming up the old topic once again: > To make it short, the names 'creal' and 'ireal' will simply lead anyone with > some background in mathematics laugh out loud and lead him to refuse taking > D serious. Here is the old thread, just in case anyone else is searching for it: http://www.digitalmars.com/d/archives/28044.html (21 Apr 2004) > The old excusion 'Everyone is free to use aliases' does not count here. The > language specs sets standards that people will follow. If every library > defines their own aliases, confusion will be complete. It they don't that > means, that I have to real 'creal' and 'ireal' when I read docs or code > written by other people which will simply hurt my eyes. The "old solution" was: alias real extended; alias creal complex; alias ireal imaginary; What ever happened to the simple : "cextended" and "iextended" ? As in: > Real Numbers: > float // 32-bit single precision (about 6 digits) > double // 64-bit double precision (about 15 digits) > extended // 64/80/128-bit extended precision (platform) > > ifloat // \ > idouble // imaginary versions of the above > iextended // / > > cfloat // \ > cdouble // complex (both real and imaginary parts) > cextended // / Kinda sad that this war has been going on for almost two years ? (I'm not sure if that is longer than the Boolean War, but still) --anders |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote: > John Reimer wrote: > >> I've used a fair amount of complex math during electronics courses. Now that you mention it, I have to agree with you. I can kind of understand how this happened, though. If I'm not mistaken the "real" in mathematics and the "real" in computer science haven't always been exactly analagous. > > > http://en.wikipedia.org/wiki/Real_number says: >> In mathematics, the real numbers are intuitively defined as numbers that >> are in one-to-one correspondence with the points on an infinite line—the >> number line. The term "real number" is a retronym coined in response to >> "imaginary number". > That does state it quite clearly, doesn't it. :-) > Both float and double are equally "real numbers" too. > Yes, but float and double are computer science terms. The mistake was treating "real" as having the same heritage as those two types. The progression becomes inappropriate, especially with the mathematical definiton of "real" being so clear. It looks like "real" was used to describe a hardware register size... Perhaps this was a clumsy moniker that Intel choose? I don't know for sure. > Q for Walter: Why really was the old name of "extended" abandoned ? > It fits well with single (float), double, extended precision to me. > > iextended and cextended might not be the shortest, but they > are not as silly as "imaginary real" (ireal). Just a thought. > > > Tue, 21 Jan 2003 "Walter" <walter@digitalmars.com> writes: > >> I've never particularly liked the 'extended' keyword for 80 bit floats, and >> there is a lot of interest in complex floats and complex doubles. So, I'm >> thinking of renaming and adding a few types: >> >> extended = no longer a keyword >> real = 80 bit floating point >> cfloat = complex float >> cdouble = complex double >> creal = complex real >> ifloat = imaginary float >> idouble = imaginary double >> ireal = imaginary real >> >> This would be consistent with the way 'u' is used as a prefix for unsigned. >> >> Any thoughts? Objections? Flames <g>? > > > http://www.digitalmars.com/d/archives/10261.html > > --anders |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | "Norbert Nemec" <Norbert@Nemec-online.de> wrote in message news:cugjt3$8f$1@digitaldaemon.com... > Anders F Björklund wrote: > >> ireal // / > >> creal // / > > [ I don't really expect this rant to be taken serious by anyone, but > sorry, > I just cannot be silent about the issue... ] > > Warming up the old topic once again: > > I still think these two names are absolutely ridiculous. > Mathematically > speaking, 'imaginary' is the exact opposite of 'real', so talking of a > 'ireal' which translates to "imaginary real" is a perfect oxymoron. > > 'complex' on the other hand is a sum of a 'real' and an 'imaginary' > number, > so 'creal' is another strange construction leading to the suspicion > that > the creator of the word never really worked with complex mathematics > personally. > > To make it short, the names 'creal' and 'ireal' will simply lead > anyone with > some background in mathematics laugh out loud and lead him to refuse > taking > D serious. > > My suggestion would still be the old one: rename 'creal' to 'complex' > and > 'ireal' to 'imaginary' (the latter is hardly ever used explicitely, so > the > long name won't matter) Sounds ok to me. Are there any significant objections to this that Norbert's not seen?? > The old excusion 'Everyone is free to use aliases' does not count > here. The > language specs sets standards that people will follow. If every > library > defines their own aliases, confusion will be complete. It they don't > that > means, that I have to real 'creal' and 'ireal' when I read docs or > code > written by other people which will simply hurt my eyes. It it looks daft to mathematicians, that's a con. If they're not in a position where there are some pros to spare, it may be the con that breaks the camel's back. Mr Metaphor Mixer |
February 10, 2005 Re: [suggestion] std type aliases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <Kris_member@pathlink.com> wrote in message news:cugku2$1fj$1@digitaldaemon.com... > In article <cugjt3$8f$1@digitaldaemon.com>, Norbert Nemec says... >>To make it short, the names 'creal' and 'ireal' will simply lead >>anyone with >>some background in mathematics laugh out loud and lead him to refuse >>taking >>D serious. > > I vote they should be called 'unreal' and 'surreal' instead > > :~) Can't do that. I'm reserving them for aliasing bit and bit[] |
Copyright © 1999-2021 by the D Language Foundation