digitalmars.D.announce - DMD 0.149 release
- Walter Bright (5/5) Mar 07 2006 Changed on_scope keywords per the general consensus of the n.g.
- Georg Wrede (6/12) Mar 07 2006 I'd sure hate to be married with you!!!! :-)
- Jarrett Billingsley (4/5) Mar 07 2006 It means you can no longer write
- Georg Wrede (29/37) Mar 07 2006 Shhhhhttt! Good-bye C/C++ folks!
- Chris Miller (5/11) Mar 07 2006 You shouldn't even be doing that! You're inverting the meaning of true a...
- Georg Wrede (56/73) Mar 08 2006 Yeah, I know. (In hindsight, in this NG, maybe I should have tried to
- Oskar Linde (6/20) Mar 08 2006 I've used !! to clamp a value to {0,1} in C since ages. One advantage of...
- Derek Parnell (33/66) Mar 08 2006 I'd like to bring up two points about this. Firstly, the strcmp() functi...
- Kyle Furlong (2/52) Mar 07 2006 I suggest you read this : http://www.digitalmars.com/d/type.html before ...
- Georg Wrede (3/7) Mar 07 2006 Gee, you really must love me!
- Hasan Aljudy (6/59) Mar 07 2006 Ever heard that D supprts == on strings? =P
- Derek Parnell (46/93) Mar 07 2006 Why would anyone in their right mind code something as stupid as that? T...
- Ameer Armaly (5/42) Mar 07 2006 This has some merrit to it in my opinion; what's wrong with beeing able ...
- Derek Parnell (11/19) Mar 07 2006 You *can* cast an integer to a bool, but it must be explicit and no
- BCS (13/23) Mar 07 2006 "!!" ends up as a cast to bool
- Derek Parnell (11/40) Mar 07 2006 LOL.... try this too.
- Hasan Aljudy (3/45) Mar 07 2006 ack! this is wrong!!
- BCS (4/15) Mar 07 2006 I think this (a shorthand for compare to zero) would be a vary useful th...
- Wang Zhen (2/44) Mar 07 2006 This is an old C idiom.
- Niko Korhonen (26/29) Mar 10 2006 You abstract away vast majority of the "fundamentals" and "processor
- Derek Parnell (10/17) Mar 07 2006 Bloody marvelous! ... getting better and better every day.
- Jarrett Billingsley (3/8) Mar 07 2006 Oh, and opSliceAssign, and the if(type variable = expr) too? Just too g...
- Tom S (8/8) Mar 07 2006 Walter, you re the man !
-
Kyle Furlong
(2/12)
Mar 07 2006
I could kiss you. 0.150 == 1.0 ?
- Sean Kelly (8/13) Mar 07 2006 Could you clarify this:
- Jarrett Billingsley (3/4) Mar 07 2006 Yes. Walter isn't _that_ big of a doof :)
- Jarrett Billingsley (7/11) Mar 07 2006 Although a quick test:
- Derek Parnell (17/29) Mar 07 2006 It seems that arithmetic operators also work on booleans so I guess the
- Walter Bright (3/5) Mar 07 2006 It's a bug. Sigh. It always takes me two tries to get this right :-(
- Bruno Medeiros (10/18) Mar 08 2006 It's more than a bug. It is impossible to have arithmetic operators not
- Tom S (13/16) Mar 07 2006 Does the fact that implicit instantiation doesn't work when the template...
- Sean Kelly (31/41) Mar 07 2006 I think the feature is just mostly unfinished--I get get very simple
- Walter Bright (3/5) Mar 07 2006 Yes.
- David Medlock (16/25) Mar 07 2006 Great stuff, Walter.
- Jarrett Billingsley (6/9) Mar 07 2006 Or they'll look at it and say, "oh, well that's cool, I've always been a...
- Walter Bright (6/8) Mar 07 2006 My general experience with people who say "D is a great language, but I
- David Medlock (10/21) Mar 07 2006 Thats true, but its not exactly what I meant.
- MicroWizard (8/12) Mar 09 2006 Absolutely agree.
- Charles Hixson (33/49) Mar 12 2006 The "no GUI" really *IS* a valid reason, not just an excuse. It depends...
- MicroWizard (10/59) Mar 12 2006 Sorry, but I feel you missed the point.
- Don Clugston (18/68) Mar 13 2006 I completely agree with this. I think the language is good enough now
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (3/5) Mar 13 2006 But if you're not programming for Windows, that is not a problem... :-)
- Don Clugston (3/11) Mar 13 2006 True -- that's why I called it a symptom. The situation is no better for...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (12/19) Mar 13 2006 But is that a language problem ? Other than that D deliberately chose to...
- Don Clugston (9/31) Mar 13 2006 No, but it is a practical problem, which makes it hard to justify the
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (10/19) Mar 13 2006 What I meant was that even without a good std library, it's still ahead.
- John Reimer (5/15) Mar 07 2006 Excellent fix to the scope statement. Thank you again, Walter. I like
- Lucas Goss (5/6) Mar 07 2006 nooooooooooooooooooooooooo... I guess I was the only one that didn't
-
Walter Bright
(3/8)
Mar 07 2006
LOL. I can't please everybody
. - Sean Kelly (3/9) Mar 07 2006 I liked the old form as well. Ah well :-)
- Hasan Aljudy (2/12) Mar 07 2006 What's the inconsistency here?
- Lucas Goss (14/24) Mar 08 2006 The inconsistency is in the style of the language. Where else in the
- Hasan Aljudy (7/33) Mar 08 2006 D inherits alot of inconsistencies from C ..
- Lucas Goss (12/22) Mar 08 2006 Hmm, true. But while accepts a condition. So I can do:
- Bruno Medeiros (6/18) Mar 09 2006 Also, 'true' exists outside of while, unlike the scope keywords, so that...
- Jarrett Billingsley (4/8) Mar 08 2006 extern(C)
- Lucas Goss (13/23) Mar 08 2006 I knew there was some I wasn't thinking of. And version(name) too.
- Derek Parnell (8/17) Mar 08 2006 However, the two are different in that the first example above the order...
- AgentOrange (2/8) Mar 07 2006 this especially bites for those of us using scope as an identifier... :...
- Derek Parnell (14/26) Mar 07 2006 This is kinda off topic but I can't understand why coders still use
- AgentOrange (3/29) Mar 07 2006 #1 I completely agree with you
- Wang Zhen (2/29) Mar 07 2006 Avoid English words. Problem solved.
- MicroWizard (5/6) Mar 09 2006 ROTFL
- Mark T (3/10) Mar 11 2006 I hope you don't mean "Hungarian" notation or other cryptic naming hacks...
- Thomas Kuehne (11/37) Mar 11 2006 -----BEGIN PGP SIGNED MESSAGE-----
- Sean Kelly (3/26) Mar 11 2006 What a wonderful language :-p What does the '@' represent?
- Thomas Kuehne (12/37) Mar 12 2006 -----BEGIN PGP SIGNED MESSAGE-----
- Chris Sauls (7/17) Mar 08 2006 No no, I preferred the original myself. I also really liked the if(;) s...
- Bruno Medeiros (6/14) Mar 09 2006 I miss the 'on' in this new syntax. But anyway, I can't find any syntax
- Wang Zhen (3/13) Mar 07 2006 Great work, Walter!
- BCS (3/3) Mar 07 2006 Quote from change log:
-
Derek Parnell
(8/12)
Mar 07 2006
I comes with your C compiler
- BCS (2/13) Mar 07 2006 C compiler? Now where did I put that thing? :P
- jicman (3/9) Mar 13 2006 Huh! I just downloaded the dmc compiler and there is nothing there abou...
- Regan Heath (7/21) Mar 13 2006 Try:
- jicman (2/24) Mar 13 2006
- Walter Bright (4/8) Mar 07 2006 I haven't bothered because it will be, by definition, identical to stand...
- BCS (3/12) Mar 07 2006 Just a list of the function in the docs would be nice, one line of descr...
- Brad Roberts (7/14) Mar 07 2006 For those that don't routinely read digitalmars.D.bugs, please use
- Don Clugston (8/11) Mar 08 2006 Frightening!
- Ivan Senji (2/10) Mar 08 2006 Wow, great work Walter :)
- Kevin Bealer (5/10) Mar 08 2006 Excellent! Just to clarify though...
- Jarrett Billingsley (4/7) Mar 08 2006 Nah. You can use them as much as you like.
Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.html
Mar 07 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Aahh, being modest.....http://www.digitalmars.com/d/changelog.htmlI'd sure hate to be married with you!!!! :-) Just impressive! --- BTW, what does "Implicit casts of non-bool to bool disallowed" mean?
Mar 07 2006
"Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...BTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;
Mar 07 2006
Jarrett Billingsley wrote:"Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...Shhhhhttt! Good-bye C/C++ folks! It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match which, incidentally, is one of the more profound proposititions in any C-derived language. The Old School Boolean C Logic was a perfectly functioning Concept. This fact _alone_ was the reason "Bool" took so long to be "formally" introduced into either C or C++. No regular programmer ever needed Prude Bool, only the Superior Theoreticians Thought it Wise to force this upon the language. It was profoundly useful as-is, and didn't need any pimping. A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.) The other night [in the D newsgroup, when it was getting hilarious] it dawned to me, that quite [too] many of the vocatious NG-members never had read their Boolean IT Fundamentals. Good Grief: "there's just too many instances in history where the illiterati have dictated the outcome of otherwise intellectual confrontations". Damn!! The ramifications of this (minor looking) modification are grave, I'm afraid. Now what happens to if (stcmp("foo", "bar")) {} ???BTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;
Mar 07 2006
On Tue, 07 Mar 2006 19:47:38 -0500, Georg Wrede <georg.wrede nospam.org> wrote:but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no matchYou shouldn't even be doing that! You're inverting the meaning of true and false. Use int.Now what happens to if (stcmp("foo", "bar")) {}If this wasn't allowed I'd be furious.
Mar 07 2006
Chris Miller wrote:On Tue, 07 Mar 2006 19:47:38 -0500, Georg Wrede <georg.wrede nospam.org> wrote:Yeah, I know. (In hindsight, in this NG, maybe I should have tried to find a C function that returns 0 on failure. :-) ) Then again it's supposed to be easy to use C from D, and there are a lot of functions that return int values such that zero signifies true and anything else signifies false, and, one is also supposed to be able to use the particular [nonzero] return value for other purposes. (Call this old school efficiency or whatever, but as long as we are supposed to use C libraries, that's what we'll have to live with.)but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no matchYou shouldn't even be doing that! You're inverting the meaning of true and false. Use int.I bet you wouldn't be alone! In the first example, the reason for using bool was to be explicit about *not* intending to use the value for other than true/false, otherwise of course an int would be used instead. Admittedly, bool x = strcmp("foo", "bar"); is bad code. Inverted meaning of x, and also a nonobvious name for a boolean variable. Better would be bool areDifferent = strcmp("foo", "bar"); (which unfortunately doesn't compile on 0.149), or better bool stringsMatch = ! strcmp("foo", "bar"); but this would have diverted the point of the example, since the "!" makes the code compilable! For C functions that return int to signify truth value, one now (as of 0.149) has to do a cast. That becomes cumbersome if one has to do a lot of C library usage. It also makes the code less readable. Seems there are two options bool a,b,c,d; a = cast(bool) strcmp("foo", "bar"); b = cast(bool) strcmp("foo", "baf"); c = cast(bool) strcmp("foo", "bag"); d = cast(bool) strcmp("foo", "bad"); or the newly found "cast to bool operator", brought up by BCS (in D.announce 3032) a = !! strcmp("foo", "bar"); b = !! strcmp("foo", "baf"); c = !! strcmp("foo", "bag"); d = !! strcmp("foo", "bad"); This is certainly less typing, and it shrouds less the original code. If it weren't for this discovery, I'd have a *hard time* living with this last change in D. So the "!!" might become a much used idiom in D now. I wonder what the reaction from the C++ crowd will be. --- (Aside:) In real code of course, one should never invert booleans, and one should always use variable names with semantic content for the reader. Thus, one probably would write something like bool match; match = ! strcmp("foo", "bar"); if (match) { /* do stuff */ } else { /* call the cops! */ }Now what happens to if (stcmp("foo", "bar")) {}If this wasn't allowed I'd be furious.
Mar 08 2006
Georg Wrede skrev:or the newly found "cast to bool operator", brought up by BCS (in D.announce 3032) a = !! strcmp("foo", "bar"); b = !! strcmp("foo", "baf"); c = !! strcmp("foo", "bag"); d = !! strcmp("foo", "bad"); This is certainly less typing, and it shrouds less the original code. If it weren't for this discovery, I'd have a *hard time* living with this last change in D. So the "!!" might become a much used idiom in D now. I wonder what the reaction from the C++ crowd will be.I've used !! to clamp a value to {0,1} in C since ages. One advantage of having to use !! is that the performance penalty of converting to bool is no longer hidden. (This may not be so bad on x86 (or, setne), but may on other architectures involve branching). /Oskar
Mar 08 2006
On Wed, 08 Mar 2006 21:49:22 +1100, Georg Wrede <georg.wrede nospam.org> wrote:For C functions that return int to signify truth value, one now (as of 0.149) has to do a cast. That becomes cumbersome if one has to do a lot of C library usage. It also makes the code less readable.I'd like to bring up two points about this. Firstly, the strcmp() function is not really the one you need to have as an example of C-programs-that-return-an-int-as-a-boolean. This function is actually designed to return one of *three* values - not a boolean. It returns zero if the two strings are equal, an integer less than zero if the first string is less than the second, and an integer greater than zero if the first string is greater than the second. So the proper way to use this return value is to compare it to zero. if (strcmp("foo", datafld ) == 0) // equal strings if (strcmp("foo", datafld ) < 0) // "foo" is less than datafld if (strcmp("foo", datafld ) > 0) // "foo" is greater than datafld if (strcmp("foo", datafld ) != 0) // "foo" is different to datafld etc ... Using the result as if it is a boolean is a mistake. The second point is that C is not D. When interfacing with any foreign data source, one must expect to do data conversions when the two systems implement similar paradigms differently. Thus if one is interfacing to a C function and that C function returns a boolean that is implemented as an int, the D program ought to convert the C data into the equivalent D data form. This is a good programming practice. By the way, if strcmp() was even converted to a pure D function, it still wouldn't return a bool.Seems there are two options bool a,b,c,d; a = cast(bool) strcmp("foo", "bar"); b = cast(bool) strcmp("foo", "baf"); c = cast(bool) strcmp("foo", "bag"); d = cast(bool) strcmp("foo", "bad"); or the newly found "cast to bool operator", brought up by BCS (in D.announce 3032) a = !! strcmp("foo", "bar"); b = !! strcmp("foo", "baf"); c = !! strcmp("foo", "bag"); d = !! strcmp("foo", "bad"); This is certainly less typing, and it shrouds less the original code. If it weren't for this discovery, I'd have a *hard time* living with this last change in D.But it is wrong to treat strcmp this way, but I understand that this is not your point really. Clarity in code is to write in such a way as to make your intentions obvious to other readers of your code.So the "!!" might become a much used idiom in D now.I don't think so...it is too obtuse and not very clear.--- (Aside:) In real code of course, one should never invert booleans, and one should always use variable names with semantic content for the reader. Thus, one probably would write something like bool match; match = ! strcmp("foo", "bar"); if (match) { /* do stuff */ } else { /* call the cops! */ }Actually, it probably should be more like ... match = (strcmp("foo", "bar") == 0); -- Derek Parnell Melbourne, Australia
Mar 08 2006
Georg Wrede wrote:Jarrett Billingsley wrote:I suggest you read this : http://www.digitalmars.com/d/type.html before you make an ass of yourself. Oops, too late."Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...Shhhhhttt! Good-bye C/C++ folks! It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match which, incidentally, is one of the more profound proposititions in any C-derived language. The Old School Boolean C Logic was a perfectly functioning Concept. This fact _alone_ was the reason "Bool" took so long to be "formally" introduced into either C or C++. No regular programmer ever needed Prude Bool, only the Superior Theoreticians Thought it Wise to force this upon the language. It was profoundly useful as-is, and didn't need any pimping. A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.) The other night [in the D newsgroup, when it was getting hilarious] it dawned to me, that quite [too] many of the vocatious NG-members never had read their Boolean IT Fundamentals. Good Grief: "there's just too many instances in history where the illiterati have dictated the outcome of otherwise intellectual confrontations". Damn!! The ramifications of this (minor looking) modification are grave, I'm afraid. Now what happens to if (stcmp("foo", "bar")) {} ???BTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;
Mar 07 2006
Kyle Furlong wrote:Georg Wrede wrote: I suggest you read this : http://www.digitalmars.com/d/type.html before you make an ass of yourself. Oops, too late.Gee, you really must love me! Ok, I'll check that out.
Mar 07 2006
Ever heard that D supprts == on strings? =P if( "foo" == "bar" ) { //code that never executes } Georg Wrede wrote:Jarrett Billingsley wrote:"Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...Shhhhhttt! Good-bye C/C++ folks! It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match which, incidentally, is one of the more profound proposititions in any C-derived language. The Old School Boolean C Logic was a perfectly functioning Concept. This fact _alone_ was the reason "Bool" took so long to be "formally" introduced into either C or C++. No regular programmer ever needed Prude Bool, only the Superior Theoreticians Thought it Wise to force this upon the language. It was profoundly useful as-is, and didn't need any pimping. A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.) The other night [in the D newsgroup, when it was getting hilarious] it dawned to me, that quite [too] many of the vocatious NG-members never had read their Boolean IT Fundamentals. Good Grief: "there's just too many instances in history where the illiterati have dictated the outcome of otherwise intellectual confrontations". Damn!! The ramifications of this (minor looking) modification are grave, I'm afraid. Now what happens to if (stcmp("foo", "bar")) {} ???BTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;
Mar 07 2006
On Wed, 08 Mar 2006 02:47:38 +0200, Georg Wrede wrote:Jarrett Billingsley wrote:Why would anyone in their right mind code something as stupid as that? This just misleads people who have to read your code. Instead do either ... bool x = cast(bool)strcmp("foo", "bar"); or int x = strcmp("foo", "bar"); or auto x = strcmp("foo", "bar"); In other words, code what you mean and mean what you code."Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...Shhhhhttt! Good-bye C/C++ folks! It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no matchBTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;which, incidentally, is one of the more profound proposititions in any C-derived language.Profoundly dumb. <g>The Old School Boolean C Logic was a perfectly functioning Concept. This fact _alone_ was the reason "Bool" took so long to be "formally" introduced into either C or C++. No regular programmer ever needed Prude Bool, only the Superior Theoreticians Thought it Wise to force this upon the language. It was profoundly useful as-is, and didn't need any pimping.Are you deliberately trolling? I am a "regular programmer" and a correctly implemented boolean type is exactly what I need. What on Earth is "profoundly useful" about assigning a number to a boolean variable? It is far better (read: cost efficient at compile time, run time, and maintenance time) to code your intentions rather than taking advantage of a language's quirky 'features'. Such behaviour is only (IMNSHO) acceptable in absolutely runtime performance critical fragments, and then only if heavily and accurately documented.A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.)You seem to be confusing implementation with syntax/semantics. The compiler can do the semantic analysis correctly and then implement the code in the most efficient manner for the target platform. These are independent of each other.The other night [in the D newsgroup, when it was getting hilarious] it dawned to me, that quite [too] many of the vocatious NG-members never had read their Boolean IT Fundamentals.And yet, you don't seem to "get it" either.Good Grief: "there's just too many instances in history where the illiterati have dictated the outcome of otherwise intellectual confrontations". Damn!! The ramifications of this (minor looking) modification are grave, I'm afraid. Now what happens to if (stcmp("foo", "bar")) {} ???This really shows that you are reading too much into the issue and not reading the specs themselves. In fact, a 2-minute test would answer this question for you anyway! import std.stdio; int Foo(int x) { return x; } void main() { bool x = cast(bool)Foo(0); if (!x) { writefln(" do stuff "); } else { writefln("call the cops!"); } if(Foo(2)) writefln("Foo(2)"); if(Foo(0)) writefln("Foo(0)"); } -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 12:14:18 PM
Mar 07 2006
"Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E29AA.1090408 nospam.org...Jarrett Billingsley wrote:This has some merrit to it in my opinion; what's wrong with beeing able to cast an int to a bool; it allows the above stated functionality, but doesn't really present any harms that I can see."Georg Wrede" <georg.wrede nospam.org> wrote in message news:440E1336.3050608 nospam.org...Shhhhhttt! Good-bye C/C++ folks! It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match which, incidentally, is one of the more profound proposititions in any C-derived language. The Old School Boolean C Logic was a perfectly functioning Concept. This fact _alone_ was the reason "Bool" took so long to be "formally" introduced into either C or C++. No regular programmer ever needed Prude Bool, only the Superior Theoreticians Thought it Wise to force this upon the language. It was profoundly useful as-is, and didn't need any pimping. A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.) The other night [in the D newsgroup, when it was getting hilarious] it dawned to me, that quite [too] many of the vocatious NG-members never had read their Boolean IT Fundamentals. Good Grief: "there's just too many instances in history where the illiterati have dictated the outcome of otherwise intellectual confrontations". Damn!! The ramifications of this (minor looking) modification are grave, I'm afraid. Now what happens to if (stcmp("foo", "bar")) {} ???BTW, what does "Implicit casts of non-bool to bool disallowed" mean?It means you can no longer write bool x = 5;
Mar 07 2006
On Tue, 7 Mar 2006 21:02:11 -0500, Ameer Armaly wrote:You *can* cast an integer to a bool, but it must be explicit and no implicit. bool x = cast(bool)42; // okay bool x = 42; // not okay -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 1:11:07 PMNow what happens to if (stcmp("foo", "bar")) {} ???This has some merrit to it in my opinion; what's wrong with beeing able to cast an int to a bool; it allows the above stated functionality, but doesn't really present any harms that I can see.
Mar 07 2006
It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match"!!" ends up as a cast to bool try: import std.stdio; int main() { int i = 1; int j = 2; int k = 0; if(!!i)writef("i\n");else writef("!i\n"); if(!!j)writef("j\n");else writef("!j\n"); if(!!k)writef("k\n");else writef("!k\n"); return 0; }
Mar 07 2006
On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:LOL.... try this too. writefln("%s %s", !!i, !!k); I get "true false" in return. Now this qualifies as a real D-Geek operator. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 1:15:38 PMIt's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match"!!" ends up as a cast to bool try: import std.stdio; int main() { int i = 1; int j = 2; int k = 0; if(!!i)writef("i\n");else writef("!i\n"); if(!!j)writef("j\n");else writef("!j\n"); if(!!k)writef("k\n");else writef("!k\n"); return 0; }
Mar 07 2006
Derek Parnell wrote:On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:ack! this is wrong!! apparently, ! returns a boolLOL.... try this too. writefln("%s %s", !!i, !!k); I get "true false" in return. Now this qualifies as a real D-Geek operator.It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match"!!" ends up as a cast to bool try: import std.stdio; int main() { int i = 1; int j = 2; int k = 0; if(!!i)writef("i\n");else writef("!i\n"); if(!!j)writef("j\n");else writef("!j\n"); if(!!k)writef("k\n");else writef("!k\n"); return 0; }
Mar 07 2006
[snips]I think this (a shorthand for compare to zero) would be a vary useful thing to have officially in D, it would negate a lot of the arguments against pure bools without diluting them (much).ack! this is wrong!! apparently, ! returns a boolint main() { int k = 0; if(!!k)writef("k\n");else writef("!k\n");LOL.... try this too. writefln("%s %s", !!i, !!k);
Mar 07 2006
Derek Parnell wrote:On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:This is an old C idiom.LOL.... try this too. writefln("%s %s", !!i, !!k); I get "true false" in return. Now this qualifies as a real D-Geek operator.It's not like anybody would want to write exactly bool x = 5; but more like bool x = strcmp("foo", "bar"); if (!x) { /* do stuff */ } // match else { /* call the cops! */ } // no match"!!" ends up as a cast to bool try: import std.stdio; int main() { int i = 1; int j = 2; int k = 0; if(!!i)writef("i\n");else writef("!i\n"); if(!!j)writef("j\n");else writef("!j\n"); if(!!k)writef("k\n");else writef("!k\n"); return 0; }
Mar 07 2006
Georg Wrede wrote:A language that purports to be "to-the-metal" just has to take into consideration the fundamentals of [digital] life. And processor physics. (Wanna abstract away that? Then go to Java or whatever.)You abstract away vast majority of the "fundamentals" and "processor physics" if you program in C instead of binary machine language or a specialized assembler. Actually I daresay that unless you have a PhD in physics and work at Intel or AMD you probably have already abstracted away most of processor physics, which use the word 'quantum' a lot. Let's do an example: just how closely C's standard IO facilities corresponds with implementations of actual file systems in operating systems? Not very closely at all. Indeed, they are nothing alike. C's IO system is a very high-level abstraction, even if it seems low-level because of it's design. All recent operating systems have a much more modern and "high-level" API for IO than C, even when they are of lower abstraction level, and therefore actually more low-level than C's. Do not confuse low-level with poor language design, that's what K&R and Stroustrup did. Furthermore, processor instruction sets have evolved way beyond C; do you have anything equivalent to vectorization, pareller execution or hardware threads in standard C? C may have had some resemblance to instruction sets and operating fundamentals of some specific computer architecture in the 1970's, but it hasn't had that in decades. Face it, even C is a high-level abstraction built on abstraction (which chooses to represent boolean values as integers). Every high level language is. Again, do not confuse poor design with efficiency and "low-levelism". -- Niko Korhonen SW Developer
Mar 10 2006
On Tue, 7 Mar 2006 15:02:41 -0800, Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlBloody marvelous! ... getting better and better every day. Thanks for all the hard work and great results. I'm sorry to heap so much shit on you from time to time <G> -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 10:13:42 AM
Mar 07 2006
"Walter Bright" <newshound digitalmars.com> wrote in message news:dul3ku$2sv2$1 digitaldaemon.com...Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlOh, and opSliceAssign, and the if(type variable = expr) too? Just too good.
Mar 07 2006
Walter, you re the man ! -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Mar 07 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlI could kiss you. 0.150 == 1.0 ? <g>
Mar 07 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Could you clarify this: "& | ^ &= |= ^= ! && || ?: are now only operators allowed on bools" Did you mean "are now _the_ only operators allowed on bools?" I can't imagine that bitwise operations would be disallowed on integers. As for ITI... I've already got some overloaded functions written that haven been waiting on this, so I'll let you know how it goes. Sean
Mar 07 2006
"Sean Kelly" <sean f4.ca> wrote in message news:dul5n8$2us7$1 digitaldaemon.com...Did you mean "are now _the_ only operators allowed on bools?"Yes. Walter isn't _that_ big of a doof :)
Mar 07 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dul5sr$2vee$1 digitaldaemon.com..."Sean Kelly" <sean f4.ca> wrote in message news:dul5n8$2us7$1 digitaldaemon.com...Although a quick test: bool x = true; int y = x * 5; bool z = true / false; Hmm..Did you mean "are now _the_ only operators allowed on bools?"Yes. Walter isn't _that_ big of a doof :)
Mar 07 2006
On Tue, 07 Mar 2006 15:41:28 -0800, Sean Kelly wrote:Walter Bright wrote:It seems that arithmetic operators also work on booleans so I guess the operator list above is either not correct or this is a bug. auto q = true + true + true; writefln("%s %s", true + true + true, q); gives "3 3" but I was expecting that the form "<expression> <arithmetic-op> <expression>" where either <expression> is a boolean result would be a syntax error. Instead, it seems to be implicitly casting the boolean to an int before the operation is examined. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 1:36:18 PMChanged on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Could you clarify this: "& | ^ &= |= ^= ! && || ?: are now only operators allowed on bools" Did you mean "are now _the_ only operators allowed on bools?"
Mar 07 2006
"Derek Parnell" <derek psych.ward> wrote in message news:1o1ukrzuobjw5$.19cyl0ofx7fqs$.dlg 40tude.net...It seems that arithmetic operators also work on booleans so I guess the operator list above is either not correct or this is a bug.It's a bug. Sigh. It always takes me two tries to get this right :-(
Mar 07 2006
Walter Bright wrote:"Derek Parnell" <derek psych.ward> wrote in message news:1o1ukrzuobjw5$.19cyl0ofx7fqs$.dlg 40tude.net...It's more than a bug. It is impossible to have arithmetic operators not work on booleans, if you have implicit conversion from bool to int. Because bools will be threated like an int. Isn't it right? What we should have, is not have implicit conversion from bool to non-bool. Let me recall a post I made, which I don't know if you read, for more info: news://news.digitalmars.com:119/du9cnl$2h9j$3 digitaldaemon.com -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DIt seems that arithmetic operators also work on booleans so I guess the operator list above is either not correct or this is a bug.It's a bug. Sigh. It always takes me two tries to get this right :-(
Mar 08 2006
Walter Bright wrote:The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Does the fact that implicit instantiation doesn't work when the template is a member of a class also belong to the 'limitation' category ? The error messages are quite misleading: "Foo.bar is not a declaration" and "template moduleName.Foo.bar(T) templates don't have properties" if Foo is a struct instead. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Mar 07 2006
Tom S wrote:Walter Bright wrote:I think the feature is just mostly unfinished--I get get very simple cases to work, but that's it. For example, in the code below, templA works just fine, but the slightly fancier templB is not accepted: C:\code\d>type test.d import std.c.stdio; template templA( Type ) { void templA( Type val ) { printf( "%.*s\n", typeid(Type).classinfo.name ); } } template templB( Type ) { void templB( Type[] val1, Type val2 ) { printf( "%.*s\n", typeid(Type).classinfo.name ); } } void main() { templA( "blah" ); templB( "blah", 'b' ); } C:\code\d>dmd test.d test.d(22): template test.templB(Type) does not match any template declaration test.d(22): template test.templB(Type) cannot deduce template function from argument types (char[4],char) C:\code\d>The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Does the fact that implicit instantiation doesn't work when the template is a member of a class also belong to the 'limitation' category ? The error messages are quite misleading: "Foo.bar is not a declaration" and "template moduleName.Foo.bar(T) templates don't have properties" if Foo is a struct instead.
Mar 07 2006
"Tom S" <h3r3tic remove.mat.uni.torun.pl> wrote in message news:dul6ve$30gp$1 digitaldaemon.com...Does the fact that implicit instantiation doesn't work when the template is a member of a class also belong to the 'limitation' category ?Yes.
Mar 07 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlGreat stuff, Walter. I hope you get 1.0 out before Google or IBM gets to you! The scope stuff is very, very cool. However, let me be a lone dissenter against the new if( auto = ) stuff. My issue with it is what it may do to developers taking a peek at D. C-Junkie: "Well there is my old reliable if statement...wait a minute...whats all this then? This language is too weird, I am going back to my comfortable (language-X)." This is yet another corner case bound to look small to experienced users but may shy away others from the language. Again I vote for: with( expression ) { ... } else { ... } if expression is null then the else block is executed. Of course, just my humble opinion. -DavidM
Mar 07 2006
"David Medlock" <noone nowhere.com> wrote in message news:dulc2p$7m4$1 digitaldaemon.com...C-Junkie: "Well there is my old reliable if statement...wait a minute...whats all this then? This language is too weird, I am going back to my comfortable (language-X)."Or they'll look at it and say, "oh, well that's cool, I've always been able to do that in for loops, now I can do it in ifs as well!" And if they give up on a language because of one new feature, they don't deserve to be using it.
Mar 07 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dulcil$86q$1 digitaldaemon.com...And if they give up on a language because of one new feature, they don't deserve to be using it.My general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.
Mar 07 2006
Walter Bright wrote:"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dulcil$86q$1 digitaldaemon.com...Thats true, but its not exactly what I meant. I mean that its still adding corner cases to a simple construct. Corner cases make C++ the headache it is, but I am sure that each addition looked really small at the time. Ironically the declaration-in-for-statement is not really that important in D thanks to foreach. Its trivial though so I will withdraw my complaint. Cheers. -DavidMAnd if they give up on a language because of one new feature, they don't deserve to be using it.My general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.
Mar 07 2006
My general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.Absolutely agree. I have told to many "friends" to check D site and tell me their opinions. Most of them had excuses: no IDE, no GUI, no ... bla-bla-bla And they use Visual Studio with Intellisense and such crap. (I use DMD as regular compiler for small inhouse projects for two years. And I really like it.) D is not for every "code writer", it is for developers. Tamas Nagy
Mar 09 2006
MicroWizard wrote:The "no GUI" really *IS* a valid reason, not just an excuse. It depends on what your project is. I currently have two projects in mind. For one of them I may choose D, for the other...no stable GUI is a project killer. N.B.: This is not unique to D. Every new language comes to this problem, which may be condensed into a simple word: LIBRARIES!!! This is why a GOOD connection to C is so important to D. (And it's why an automated build tool that can add C code and D code together is important.) In the early days I remember a comment where Walter was looking at adding an automatic conversion of C header files into D files ... and decided that it was too difficult a job to do in a general way. (He also pointed at his C or C++ [I forget which] compiler, and showed how to use it as a preprocessor...which didn't help me as I'm using Linux, but demonstrated that he DID understand the problem.) Actually, a version of this is why I've chosen Python over Ruby for some projects. I think that Ruby is a much better language, but Python started earlier, so Python has the libraries. This is a serious problem, and I don't know any way to solve it. It can "sort of" be handled by just continuing on, and developing libraries in passing. Over time the most critical libraries will be added. But note that Ruby is STILL severely behind Python. This is not a problem that can be handled quickly in this way. A solution would dissolve the problem by allowing transparent access to, e.g., C libraries. (Even this wouldn't be a total solution, because then there will be the problem of documentation...where the documentation for the libraries will all be directed at users of the original language.) This is probably a problem that we must be satisfied with handling rather than solving. Over time it will decrease in importance. Currently, while the GUI and database libraries are missing/primitive/fragile ... well, a lot of the time D won't be the correct language, even though as a language it would be the correct choice. -- Work in progressMy general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.Absolutely agree. I have told to many "friends" to check D site and tell me their opinions. Most of them had excuses: no IDE, no GUI, no ... bla-bla-bla And they use Visual Studio with Intellisense and such crap. (I use DMD as regular compiler for small inhouse projects for two years. And I really like it.) D is not for every "code writer", it is for developers. Tamas Nagy
Mar 12 2006
Sorry, but I feel you missed the point. No language was born _with_ libraries. Not M$ ones. Who want to use D imediately he/she is a coder, not a developer, who tries to use the possibilities. In my professional life I have to work with M$ things. That place I am a coder only. I satisfy customer's needs. I use RAD. I earn money. I often hate it. In this community I can see the possibility to participate in some good new things to create. It needs time to grow. No reason to hurry. Tamas Nagy In article <dv243r$1qa$1 digitaldaemon.com>, Charles Hixson says...MicroWizard wrote:The "no GUI" really *IS* a valid reason, not just an excuse. It depends on what your project is. I currently have two projects in mind. For one of them I may choose D, for the other...no stable GUI is a project killer. N.B.: This is not unique to D. Every new language comes to this problem, which may be condensed into a simple word: LIBRARIES!!! This is why a GOOD connection to C is so important to D. (And it's why an automated build tool that can add C code and D code together is important.) In the early days I remember a comment where Walter was looking at adding an automatic conversion of C header files into D files ... and decided that it was too difficult a job to do in a general way. (He also pointed at his C or C++ [I forget which] compiler, and showed how to use it as a preprocessor...which didn't help me as I'm using Linux, but demonstrated that he DID understand the problem.) Actually, a version of this is why I've chosen Python over Ruby for some projects. I think that Ruby is a much better language, but Python started earlier, so Python has the libraries. This is a serious problem, and I don't know any way to solve it. It can "sort of" be handled by just continuing on, and developing libraries in passing. Over time the most critical libraries will be added. But note that Ruby is STILL severely behind Python. This is not a problem that can be handled quickly in this way. A solution would dissolve the problem by allowing transparent access to, e.g., C libraries. (Even this wouldn't be a total solution, because then there will be the problem of documentation...where the documentation for the libraries will all be directed at users of the original language.) This is probably a problem that we must be satisfied with handling rather than solving. Over time it will decrease in importance. Currently, while the GUI and database libraries are missing/primitive/fragile ... well, a lot of the time D won't be the correct language, even though as a language it would be the correct choice. -- Work in progressMy general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.Absolutely agree. I have told to many "friends" to check D site and tell me their opinions. Most of them had excuses: no IDE, no GUI, no ... bla-bla-bla And they use Visual Studio with Intellisense and such crap. (I use DMD as regular compiler for small inhouse projects for two years. And I really like it.) D is not for every "code writer", it is for developers. Tamas Nagy
Mar 12 2006
Charles Hixson wrote:MicroWizard wrote:I completely agree with this. I think the language is good enough now that future progress will be limited by the quality of the libraries. The most severe symptom is that right now, D doesn't even have proper windows headers! IMHO, it's not currently suitable for anything that involves I/O other than reading and writing files. The 'implib' tool has done a lot to improve the situation with respect to C libraries -- now at least we can link to them. We just need a header file converter. I've been trying to understand the 'problem space' for C -> D header conversion. It seems to me, that it is a solvable problem, once you accept that because of ambiguities in the C preprocessor, a fully automatic conversion is impossible. My proposed solution is to have a prepreprocessor, which modifies a C header into a format without ambiguities, which can then be converted automatically. I think that if we had such a tool, D would be vastly more usable. I think this issue is about to become 'mission critical' for D.The "no GUI" really *IS* a valid reason, not just an excuse. It depends on what your project is. I currently have two projects in mind. For one of them I may choose D, for the other...no stable GUI is a project killer. N.B.: This is not unique to D. Every new language comes to this problem, which may be condensed into a simple word: LIBRARIES!!! This is why a GOOD connection to C is so important to D. (And it's why an automated build tool that can add C code and D code together is important.) In the early days I remember a comment where Walter was looking at adding an automatic conversion of C header files into D files ... and decided that it was too difficult a job to do in a general way. (He also pointed at his C or C++ [I forget which] compiler, and showed how to use it as a preprocessor...which didn't help me as I'm using Linux, but demonstrated that he DID understand the problem.) Actually, a version of this is why I've chosen Python over Ruby for some projects. I think that Ruby is a much better language, but Python started earlier, so Python has the libraries. This is a serious problem, and I don't know any way to solve it. It can "sort of" be handled by just continuing on, and developing libraries in passing. Over time the most critical libraries will be added. But note that Ruby is STILL severely behind Python. This is not a problem that can be handled quickly in this way. A solution would dissolve the problem by allowing transparent access to, e.g., C libraries. (Even this wouldn't be a total solution, because then there will be the problem of documentation...where the documentation for the libraries will all be directed at users of the original language.) This is probably a problem that we must be satisfied with handling rather than solving. Over time it will decrease in importance. Currently, while the GUI and database libraries are missing/primitive/fragile ... well, a lot of the time D won't be the correct language, even though as a language it would be the correct choice.My general experience with people who say "D is a great language, but I won't use it because of <minor nitpick> because <minor nitpick> is the most important thing in the world" is that they won't use it anyway, and are just looking for an excuse.Absolutely agree. I have told to many "friends" to check D site and tell me their opinions. Most of them had excuses: no IDE, no GUI, no ... bla-bla-bla And they use Visual Studio with Intellisense and such crap. (I use DMD as regular compiler for small inhouse projects for two years. And I really like it.) D is not for every "code writer", it is for developers. Tamas Nagy
Mar 13 2006
Don Clugston wrote:The most severe symptom is that right now, D doesn't even have proper windows headers!But if you're not programming for Windows, that is not a problem... :-) --anders
Mar 13 2006
Anders F Björklund wrote:Don Clugston wrote:True -- that's why I called it a symptom. The situation is no better for Linux, and seems like the Mac guys don't even have a compiler...The most severe symptom is that right now, D doesn't even have proper windows headers!But if you're not programming for Windows, that is not a problem... :-)--anders
Mar 13 2006
Don Clugston wrote:But is that a language problem ? Other than that D deliberately chose to not be read-compatible with C headers, or linkable with C++ libraries ? We all agree that a C-header-to-D-import module tool would be useful, I think Walter even noted that on the DMD compiler page from the start. But when I've translated the headers, the rest seems to be working... Except for templates of course, but that's "just a Mac problem" eh ? Just think that there are bigger bugs with Phobos than just missing some Windows headers or having incomplete headers for the C stdlib... I have a library here that I can compare implementations for, and out of C++ and Objective-C and now D - the D version is the neatest one by far! --andersTrue -- that's why I called it a symptom. The situation is no better for Linux, and seems like the Mac guys don't even have a compiler...The most severe symptom is that right now, D doesn't even have proper windows headers!But if you're not programming for Windows, that is not a problem... :-)
Mar 13 2006
Anders F Björklund wrote:Don Clugston wrote:No, but it is a practical problem, which makes it hard to justify the use of D.But is that a language problem ? Other than that D deliberately chose to not be read-compatible with C headers, or linkable with C++ libraries ?True -- that's why I called it a symptom. The situation is no better for Linux, and seems like the Mac guys don't even have a compiler...The most severe symptom is that right now, D doesn't even have proper windows headers!But if you're not programming for Windows, that is not a problem... :-)We all agree that a C-header-to-D-import module tool would be useful, I think Walter even noted that on the DMD compiler page from the start. But when I've translated the headers, the rest seems to be working... Except for templates of course, but that's "just a Mac problem" eh ? Just think that there are bigger bugs with Phobos than just missing some Windows headers or having incomplete headers for the C stdlib...I didn't intend to imply that there were no other symptoms... <g>I have a library here that I can compare implementations for, and out of C++ and Objective-C and now D - the D version is the neatest one by far!You're preaching to the converted <g>. Right now we have a world-beating language, that's totally embarrassed about the state of its libraries (the IDE is a minor issue in comparison). It's a genuine, serious problem. It might not be too hard to fix, but that doesn't stop it from being a blocker right now.
Mar 13 2006
Don Clugston wrote:What I meant was that even without a good std library, it's still ahead. (The C++ version was using Carbon, and the Objective-C was using Cocoa) I guess that's a side-effect of the "don't do in a standard library what can be done in the compiler", which seems to be a part of D philosophy ?I have a library here that I can compare implementations for, and out of C++ and Objective-C and now D - the D version is the neatest one by far!You're preaching to the converted <g>.Right now we have a world-beating language, that's totally embarrassed about the state of its libraries (the IDE is a minor issue in comparison). It's a genuine, serious problem. It might not be too hard to fix, but that doesn't stop it from being a blocker right now.I wrapped my own "showstopper" libraries, so those weren't really it... I've found that people invent other reasons, to not have to look at D ? The good part is that "C" libraries can be used by all three languages. (the bad of course being that I then need to code the whole thing in C) --anders
Mar 13 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlExcellent fix to the scope statement. Thank you again, Walter. I like where this is headed. Keep up the good work. D is looking more attractive and exciting all the time. -JJR
Mar 07 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
"Lucas Goss" <lgoss007 gmail.com> wrote in message news:dulcq5$8cj$1 digitaldaemon.com...Walter Bright wrote:LOL. I can't please everybody <g>.Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time.
Mar 07 2006
Lucas Goss wrote:Walter Bright wrote:I liked the old form as well. Ah well :-) SeanChanged on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy).
Mar 07 2006
Lucas Goss wrote:Walter Bright wrote:What's the inconsistency here?Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
Hasan Aljudy wrote:Lucas Goss wrote:The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword? Yes I know exit, success, and failure aren't necessarily keywords, but they are within the context of scope() (or scope of scope, :) ). The only other instance I can think of is switch(), but "case" is in the block of the switch statement (not inside the parenthesis). All other keywords with ()'s have expressions/conditions inside. It kinda reminds me of the English language (my native tongue by the way), where some things just stick out like a sore thumb... Bologna - pronounced Bolony? Well I guess it allows us to add stuff later, as in: scope(creep) hahaha... sorry I couldn't resist :)Walter Bright wrote:What's the inconsistency here?Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time.
Mar 08 2006
Lucas Goss wrote:Hasan Aljudy wrote:while(true) :)Lucas Goss wrote:The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword?Walter Bright wrote:What's the inconsistency here?Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time.Yes I know exit, success, and failure aren't necessarily keywords, but they are within the context of scope() (or scope of scope, :) ). The only other instance I can think of is switch(), but "case" is in the block of the switch statement (not inside the parenthesis). All other keywords with ()'s have expressions/conditions inside.D inherits alot of inconsistencies from C .. for loops vs while loops.. horrible inconsistency!! You actually but semi-colon seperated statements inside the for( .. ) switch/case/break construct doesn't really resemble anything!! key_words_with_under_scores_are_worse
Mar 08 2006
Hasan Aljudy wrote:Lucas Goss wrote:Hmm, true. But while accepts a condition. So I can do: while(myTimer < 1000), while(!done) but I can't do: scope(isFinished), scope(timerAbort)The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword?while(true) :)D inherits alot of inconsistencies from C ..or Java, or a nice performing language like C/C++ or D. Why can't I have both... sigh.for loops vs while loops.. horrible inconsistency!! You actually but semi-colon seperated statements inside the for( .. )I don't like those either.switch/case/break construct doesn't really resemble anything!!Yeah, basically a bunch of if/else if/else statements in disguise.key_words_with_under_scores_are_worseYeah I don't like the key_words_with_underscores either, that's why I wanted a change, just not the kind with ()'s.
Mar 08 2006
Lucas Goss wrote:Hasan Aljudy wrote:Also, 'true' exists outside of while, unlike the scope keywords, so that really doesn't serve as an example. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DLucas Goss wrote:Hmm, true. But while accepts a condition. So I can do: while(myTimer < 1000), while(!done) but I can't do: scope(isFinished), scope(timerAbort)The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword?while(true) :)
Mar 09 2006
"Lucas Goss" <lgoss007 gmail.com> wrote in message news:dun5ej$2vej$1 digitaldaemon.com...The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword? Yes I know exit, success, and failure aren't necessarily keywords, but they are within the context of scope() (or scope of scope, :) ).extern(C) pragma(msg, "hi")
Mar 08 2006
Jarrett Billingsley wrote:"Lucas Goss" <lgoss007 gmail.com> wrote in message news:dun5ej$2vej$1 digitaldaemon.com...I knew there was some I wasn't thinking of. And version(name) too. Thinking about it, does that mean this can be done?: scope(exit) { class1.cleanup(); class2.cleanup(); } I think of it more like an event accumulator stack, not really a statement, so this just seems strange: scope(exit) class1.cleanup(); scope(exit) class2.cleanup(); Maybe because I don't do anything like: if(thisIsTrue) okToExecute();The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword? Yes I know exit, success, and failure aren't necessarily keywords, but they are within the context of scope() (or scope of scope, :) ).extern(C) pragma(msg, "hi")
Mar 08 2006
On Thu, 09 Mar 2006 07:53:20 +1100, Lucas Goss <lgoss007 gmail.com> wrote:Thinking about it, does that mean this can be done?: scope(exit) { class1.cleanup(); class2.cleanup(); }Yes.I think of it more like an event accumulator stack, not really a statement, so this just seems strange: scope(exit) class1.cleanup(); scope(exit) class2.cleanup();However, the two are different in that the first example above the order of execution is class1.cleanup then class2.cleanup, but it is reversed in -- Derek Parnell Melbourne, Australia
Mar 08 2006
In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...Walter Bright wrote:this especially bites for those of us using scope as an identifier... :(Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
On Wed, 8 Mar 2006 05:25:29 +0000 (UTC), AgentOrange wrote:In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...This is kinda off topic but I can't understand why coders still use standard words for identifiers. I mean after all these years of experience with computing languages, this is one common source of bugs and problems. So to make coding life easier, just stop using single normal words for identifiers. Pick a naming convention that prevents this habit and the chances you are going to clash with reserved words is greatly reduced. It not really all that hard. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 4:36:11 PMWalter Bright wrote:this especially bites for those of us using scope as an identifier... :(Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
In article <1osp8dzdh9ihy$.yoi1lhqbyw8f$.dlg 40tude.net>, Derek Parnell says...On Wed, 8 Mar 2006 05:25:29 +0000 (UTC), AgentOrange wrote:In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...This is kinda off topic but I can't understand why coders still use standard words for identifiers. I mean after all these years of experience with computing languages, this is one common source of bugs and problems. So to make coding life easier, just stop using single normal words for identifiers. Pick a naming convention that prevents this habit and the chances you are going to clash with reserved words is greatly reduced. It not really all that hard. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 4:36:11 PMWalter Bright wrote:this especially bites for those of us using scope as an identifier... :(Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
Derek Parnell wrote:On Wed, 8 Mar 2006 05:25:29 +0000 (UTC), AgentOrange wrote:Avoid English words. Problem solved.In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...This is kinda off topic but I can't understand why coders still use standard words for identifiers. I mean after all these years of experience with computing languages, this is one common source of bugs and problems. So to make coding life easier, just stop using single normal words for identifiers. Pick a naming convention that prevents this habit and the chances you are going to clash with reserved words is greatly reduced. It not really all that hard.Walter Bright wrote:this especially bites for those of us using scope as an identifier... :(Changed on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 07 2006
Avoid English words. Problem solved.ROTFL I am hungarian and use this technique for years ;-) But seriously ... Own programs could be written in our mother tongue, commonly used codes couldn't. Tamas Nagy
Mar 09 2006
In article <1osp8dzdh9ihy$.yoi1lhqbyw8f$.dlg 40tude.net>, Derek Parnell says...This is kinda off topic but I can't understand why coders still use standard words for identifiers. I mean after all these years of experience with computing languages, this is one common source of bugs and problems. So to make coding life easier, just stop using single normal words for identifiers. Pick a naming convention that prevents this habit and the chances you are going to clash with reserved words is greatly reduced. It not really all that hard.I hope you don't mean "Hungarian" notation or other cryptic naming hacks. I find that code style impossible to read.
Mar 11 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mark T schrieb am 2006-03-11:In article <1osp8dzdh9ihy$.yoi1lhqbyw8f$.dlg 40tude.net>, Derek Parnell says...This is kinda off topic but I can't understand why coders still use standard words for identifiers. I mean after all these years of experience with computing languages, this is one common source of bugs and problems. So to make coding life easier, just stop using single normal words for identifiers. Pick a naming convention that prevents this habit and the chances you are going to clash with reserved words is greatly reduced. It not really all that hard.I hope you don't mean "Hungarian" notation or other cryptic naming hacks. I find that code style impossible to read.class NamingOnTheRocks{ static int if(int while){ return while * while; } public static int Main(string[] args){ int return; int static = 3, switch = 8, break = 2, case = 3, true = 0; if( if( switch + break) * case != true){ return = static; }else{ return = break / static; } return return * 2; } }Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEExwM3w+/yD4P9tIRAkYcAJ4t0J7N8GBtEmqudyhqfPGtkKTTcQCeJ6KQ HOQe1kloEuePxzT+D4SvKpc= =S/gt -----END PGP SIGNATURE-----
Mar 11 2006
Thomas Kuehne wrote:What a wonderful language :-p What does the ' ' represent? Seanclass NamingOnTheRocks{ static int if(int while){ return while * while; } public static int Main(string[] args){ int return; int static = 3, switch = 8, break = 2, case = 3, true = 0; if( if( switch + break) * case != true){ return = static; }else{ return = break / static; } return return * 2; } }
Mar 11 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sean Kelly schrieb am 2006-03-11:Thomas Kuehne wrote:indicates an identifier following: "int x;" and "int x;" are identical. As a consequence you can write "int some_keyword;" while you can't write "int some_keyword;". Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEFBQL3w+/yD4P9tIRAiMGAJ9smOA/+OyRyvG8DjcEHuANzONPlwCfbt7s efcS8sgqUuY1RAEtFMqIFdw= =eSt9 -----END PGP SIGNATURE-----What a wonderful language :-p What does the ' ' represent?class NamingOnTheRocks{ static int if(int while){ return while * while; } public static int Main(string[] args){ int return; int static = 3, switch = 8, break = 2, case = 3, true = 0; if( if( switch + break) * case != true){ return = static; }else{ return = break / static; } return return * 2; } }
Mar 12 2006
Lucas Goss wrote:Walter Bright wrote:No no, I preferred the original myself. I also really liked the if(;) syntax, but alas. Although... I didn't see anything in the ChangeLog saying the if(;) syntax is /gone/, just that the if(auto=) syntax was added. Hmm. Must check that. Meanwhile, I have to deal with these scope(*) statements, with yet more language defined constants (exit/success/failure) for IDEs and highlighters to trip over. Fantastic. -- Chris Nicholson-SaulsChanged on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 08 2006
Lucas Goss wrote:Walter Bright wrote:I miss the 'on' in this new syntax. But anyway, I can't find any syntax that I do like. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DChanged on_scope keywords per the general consensus of the n.g.nooooooooooooooooooooooooo... I guess I was the only one that didn't like the proposed change of scope(...). Inconsistencies in d drive me mad (crazy). I love the language and hate it at the same time. The other changes are nice though, nice work.
Mar 09 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlGreat work, Walter! I'll throw out more bizarre test cases to help you perfect dmd ;)
Mar 07 2006
Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?
Mar 07 2006
On Tue, 07 Mar 2006 18:04:08 -0800, BCS wrote:Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I comes with your C compiler <G> -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 8/03/2006 1:12:42 PM
Mar 07 2006
Derek Parnell wrote:On Tue, 07 Mar 2006 18:04:08 -0800, BCS wrote:C compiler? Now where did I put that thing? :PQuote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I comes with your C compiler <G>
Mar 07 2006
Derek Parnell says...On Tue, 07 Mar 2006 18:04:08 -0800, BCS wrote:Huh! I just downloaded the dmc compiler and there is nothing there about fenv. Where can I find it? It's not in c:\dm. Where is it?Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I comes with your C compiler <G>
Mar 13 2006
On Tue, 14 Mar 2006 01:07:43 +0000 (UTC), jicman <jicman_member pathlink.com> wrote:Derek Parnell says...Try: http://www.digitalmars.com/rtl/fenv.html I opened std.c.fenv.d, I grabbed a function name, I google for "site:digitalmars.com <function>" and I got back that page as a result :) ReganOn Tue, 07 Mar 2006 18:04:08 -0800, BCS wrote:Huh! I just downloaded the dmc compiler and there is nothing there about fenv. Where can I find it? It's not in c:\dm. Where is it?Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I comes with your C compiler <G>
Mar 13 2006
Thanks. :-) Regan Heath says...On Tue, 14 Mar 2006 01:07:43 +0000 (UTC), jicman <jicman_member pathlink.com> wrote:Derek Parnell says...Try: http://www.digitalmars.com/rtl/fenv.html I opened std.c.fenv.d, I grabbed a function name, I google for "site:digitalmars.com <function>" and I got back that page as a result :) ReganOn Tue, 07 Mar 2006 18:04:08 -0800, BCS wrote:Huh! I just downloaded the dmc compiler and there is nothing there about fenv. Where can I find it? It's not in c:\dm. Where is it?Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I comes with your C compiler <G>
Mar 13 2006
"BCS" <BCS_member pathlink.com> wrote in message news:dule2p$5tn$1 digitaldaemon.com...Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I haven't bothered because it will be, by definition, identical to standard C documentation for those declarations.
Mar 07 2006
In article <duli9p$fl0$4 digitaldaemon.com>, Walter Bright says..."BCS" <BCS_member pathlink.com> wrote in message news:dule2p$5tn$1 digitaldaemon.com...Just a list of the function in the docs would be nice, one line of description would be terrific.Quote from change log: Added std.c.fenv. Where's the documentation? Then again where's the documentation for most of std.c.*?I haven't bothered because it will be, by definition, identical to standard C documentation for those declarations.
Mar 07 2006
On Tue, 7 Mar 2006, Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlFor those that don't routinely read digitalmars.D.bugs, please use http://d.puremagic.com/bugzilla/ to report issues. All new bugs and bug correspondence is forwarded to .bugs automatically. See .bugs for more discussion on the tracking system. Later, Brad
Mar 07 2006
Walter Bright wrote:The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work.Frightening! to swing some of the boost crowd over here. It seems that by the time you do your presentation, C++ templates will look positively archaic. <g> BTW, when you update the comparison chart, you might want to split "Value Template Parameters" into Integral (which C++ has) and floating point/string (which it doesn't).
Mar 08 2006
Walter Bright wrote:Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlWow, great work Walter :)
Mar 08 2006
In article <dul3ku$2sv2$1 digitaldaemon.com>, Walter Bright says...Changed on_scope keywords per the general consensus of the n.g. The implicit function template instantiation is a bit limited at the moment, deduction won't work for types derived from templates, and the mechanism to pick the most specialized template doesn't work. http://www.digitalmars.com/d/changelog.htmlExcellent! Just to clarify though... Are exit, success, and failure forbidden as idents or otherwise keyword-like outside of the "scope(X)" construct? Kevin
Mar 08 2006
"Kevin Bealer" <Kevin_member pathlink.com> wrote in message news:duo3sf$1j7h$1 digitaldaemon.com...Are exit, success, and failure forbidden as idents or otherwise keyword-like outside of the "scope(X)" construct?Nah. You can use them as much as you like. int exit = 5;
Mar 08 2006