D - Python 2.3 alpha incorporates bool type
- Mark Evans (5/5) Feb 13 2003 See
- Burton Radons (2/7) Feb 13 2003 "bit" has been "bool" in all ways but name since 0.50, three months ago.
- Sean L. Palmer (16/23) Feb 13 2003 So can we pass them as inout parameters yet? ;)
- Lars Ivar Igesund (8/12) Feb 14 2003 to
- Burton Radons (12/25) Feb 16 2003 Argh, these constants have been in the language since long before I got
- Roberto Mariottini (16/20) Feb 14 2003 For everyone not seeing the need for a Boolean type in a language:
See http://www.python.org/peps/pep-0285.html Python has been around for well over a decade and finally bit the bullet. There's a lesson here for D. Mark
Feb 13 2003
Mark Evans wrote:See http://www.python.org/peps/pep-0285.html Python has been around for well over a decade and finally bit the bullet. There's a lesson here for D."bit" has been "bool" in all ways but name since 0.50, three months ago.
Feb 13 2003
So can we pass them as inout parameters yet? ;) At least predefine true to equal 1 (or -1, or ~0, or whatever) and false to equal 0 so everyone else doesn't have to. Those two words are not going to be used as identifiers by sane people. anyway. Might as well reserve them. Do if/while/etc take a bit implicitly, or does it take an int and compare with zero? What is bit's .toString property defined to produce for each value? Also what are the defined semantics of conversion from int or float to bool? Surely it doesn't just keep the low bit and discard the rest, as for instance int to byte would do. If you cast bool to int what do you get? Is a bit signed, or unsigned? The types section in the D docs doesn't mention these things, but they definitely need to be defined. Sean "Burton Radons" <loth users.sourceforge.net> wrote in message news:b2hno8$86o$1 digitaldaemon.com...Mark Evans wrote:bullet.See http://www.python.org/peps/pep-0285.html Python has been around for well over a decade and finally bit theThere's a lesson here for D."bit" has been "bool" in all ways but name since 0.50, three months ago.
Feb 13 2003
"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message news:b2i6t1$kbp$1 digitaldaemon.com...So can we pass them as inout parameters yet? ;) At least predefine true to equal 1 (or -1, or ~0, or whatever) and falsetoequal 0 so everyone else doesn't have to. Those two words are not goingtobe used as identifiers by sane people. anyway. Might as well reservethem.Look at the bottom of this page: http://www.digitalmars.com/d/expression.html Lars Ivar Igesund
Feb 14 2003
Sean L. Palmer wrote:So can we pass them as inout parameters yet? ;) At least predefine true to equal 1 (or -1, or ~0, or whatever) and false to equal 0 so everyone else doesn't have to. Those two words are not going to be used as identifiers by sane people. anyway. Might as well reserve them.Argh, these constants have been in the language since long before I got here.Do if/while/etc take a bit implicitly, or does it take an int and compare with zero?If it took an int, "if (0.9)" would be false. So of course it takes a bit, inserting an explicit cast if necessary.What is bit's .toString property defined to produce for each value?There is no toString property for base types.Also what are the defined semantics of conversion from int or float to bool? Surely it doesn't just keep the low bit and discard the rest, as for instance int to byte would do. If you cast bool to int what do you get? Is a bit signed, or unsigned? The types section in the D docs doesn't mention these things, but they definitely need to be defined.They should be. The only mention is in the Changes page. These assignments are equivalent: bit a; type b; a = cast (bit) b; a = (b ? true : false);
Feb 16 2003
"Mark Evans" <Mark_member pathlink.com> ha scritto nel messaggio news:b2h7sq$2ruo$1 digitaldaemon.com...See http://www.python.org/peps/pep-0285.html Python has been around for well over a decade and finally bit the bullet. There's a lesson here for D.For everyone not seeing the need for a Boolean type in a language: 1 - Read 3 times the entire chapter about "Boolean algebra" of your good old College book. 2 - Say 100 times the following sentences: - "A boolean is not an integer, an integer is not a boolean, they are _algebraicly_ intrinsecally different" - "If 7 == true and true == -145 then 7 == -145" - "Why zero == false and nonzero == true? Why not negative == false and positive == true? Why not MAX_INT == true and random(MAX_INT) == false?" - "Why the h**l all widespread laguages, sooner or later, include a f**ing boolean type?" 3 - If you are not yet persuaded, goto 1 4 - If you are not persuaded and you are reading this, tell your analyst. Ciao
Feb 14 2003