www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Native Boolean type and more

reply Diego Lago <Diego_member pathlink.com> writes:
Since I started reading about D programming language, I like every day more, but
there are certain things that I would like that they were different.

One of the is the lack of a native boolean type. If it have a "true" and "false"
literal values, why haven't it got a native boolean type, not an alias? I would
like it was introduced into a next version, might it to be possible?

Other thing is the lack of a native string type. I know that char[] type works
like a string, but to facilitate the work of the programmers (and for
programmers pleasure also) I think that there would be interesting the addition
of a native string type to the language. It would work just a char[] but with a
native string type and keyword.

There are any other thing that I don't like, but I know that this is the best
way to do that, so I will not mention more on this matter.

Regards.

--
Diego Lago
beosman gmail.com
Feb 13 2006
next sibling parent jcc7 <jcc7_member pathlink.com> writes:
In article <dsqcbe$2dv2$1 digitaldaemon.com>, Diego Lago says...
Since I started reading about D programming language, I like every day more, but
there are certain things that I would like that they were different.

One of the is the lack of a native boolean type. If it have a "true" and "false"
literal values, why haven't it got a native boolean type, not an alias? I would
like it was introduced into a next version, might it to be possible?
I'm not sure what exactly you're requesting, but I'll go out on a limb and guess it won't be in the next version of D. The whole area of bit vs. bool vs. alias vs. "how many bits are in a bool" has been one of the most controversal topics in the D community. There are a couple of pages in Wiki4D that highlight some of the issues that people have mentioned: http://www.prowiki.org/wiki4d/wiki.cgi?BooleanNotEquBit http://www.prowiki.org/wiki4d/wiki.cgi?BitsAndBools The one sentence summary is "The way it is currently in D probably isn't going to change much if any". Walter is aware of the arguments on both sides, and he's already picked his side.
Other thing is the lack of a native string type. I know that char[] type works
like a string, but to facilitate the work of the programmers (and for
programmers pleasure also) I think that there would be interesting the addition
of a native string type to the language. It would work just a char[] but with a
native string type and keyword.
This idea isn't as controversal as bit vs. bool, but I don't think there's much more hope for your idea being adopted into the D standard library or language anytime soon. Some people have submitted code for string classes here and in dsource forums, but it seems to me that each string class has about one person who likes it (and everyone else seems to have serious problems with it). If there was a string class that had two or more supporters, perhaps a coalition could be formed to get Walter to adopt it as the standard string and add it to Phobos. ;) But I'm sure someone will let me know that I'm wrong about this, so you can take my opinion with a grain of salt.
There are any other thing that I don't like, but I know that this is the best
way to do that, so I will not mention more on this matter.
If you have other concerns about D, this is the place to mention them. Maybe someone else has run into the same problem and has a good work-around or solution. jcc7
Feb 13 2006
prev sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
Diego Lago wrote:
 Since I started reading about D programming language, I like every day more,
but
 there are certain things that I would like that they were different.
 
 One of the is the lack of a native boolean type. If it have a "true" and
"false"
 literal values, why haven't it got a native boolean type, not an alias? I would
 like it was introduced into a next version, might it to be possible?
 
 Other thing is the lack of a native string type. I know that char[] type works
 like a string, but to facilitate the work of the programmers (and for
 programmers pleasure also) I think that there would be interesting the addition
 of a native string type to the language. It would work just a char[] but with a
 native string type and keyword.
 
 There are any other thing that I don't like, but I know that this is the best
 way to do that, so I will not mention more on this matter.
 
 Regards.
 
 --
 Diego Lago
 beosman gmail.com
 
 
Diego, in regards to your string suggestion: You can do this yourself with the alias keyword. Dont like the name? Change it! alias char[] string; //or alias char[] String; //or alias char[] MyAwesomeStringType; Anything you like! The usage is remarkably intuitive to what one would expect from a string class: string s = "A string"; string t = "Another string"; writefln(s ~ t); The ouput of this is "A stringAnother string". Hope this helped!
Feb 14 2006