www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DMD 0.149 release

reply "Walter Bright" <newshound digitalmars.com> writes:
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
next sibling parent reply Georg Wrede <georg.wrede nospam.org> writes:
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.html
I'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
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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
parent reply Georg Wrede <georg.wrede nospam.org> writes:
Jarrett Billingsley wrote:
 "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;
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")) {} ???
Mar 07 2006
next sibling parent reply "Chris Miller" <chris dprogramming.com> writes:
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 match
You 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
parent reply Georg Wrede <georg.wrede nospam.org> writes:
Chris Miller wrote:
 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 match
You shouldn't even be doing that! You're inverting the meaning of true and false. Use int.
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.)
 Now what happens to

      if (stcmp("foo", "bar")) {}
If this wasn't allowed I'd be furious.
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! */ }
Mar 08 2006
next sibling parent Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
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
prev sibling parent "Derek Parnell" <derek psych.ward> writes:
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
prev sibling next sibling parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Georg Wrede wrote:
 Jarrett Billingsley wrote:
 "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;
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")) {} ???
I suggest you read this : http://www.digitalmars.com/d/type.html before you make an ass of yourself. Oops, too late.
Mar 07 2006
parent Georg Wrede <georg.wrede nospam.org> writes:
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
prev sibling next sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
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...

 BTW, what does "Implicit casts of non-bool to bool disallowed" mean?
It means you can no longer write bool x = 5;
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")) {} ???
Mar 07 2006
prev sibling next sibling parent Derek Parnell <derek psych.ward> writes:
On Wed, 08 Mar 2006 02:47:38 +0200, Georg Wrede wrote:

 Jarrett Billingsley wrote:
 "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;
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
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.
 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
prev sibling next sibling parent reply "Ameer Armaly" <ameer_armaly hotmail.com> writes:
"Georg Wrede" <georg.wrede nospam.org> wrote in message 
news:440E29AA.1090408 nospam.org...
 Jarrett Billingsley wrote:
 "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;
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")) {} ???
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
parent Derek Parnell <derek psych.ward> writes:
On Tue, 7 Mar 2006 21:02:11 -0500, Ameer Armaly wrote:

 Now 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.
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 PM
Mar 07 2006
prev sibling next sibling parent reply BCS <BCS_member pathlink.com> writes:
 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
parent reply Derek Parnell <derek psych.ward> writes:
On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:

 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; }
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 PM
Mar 07 2006
next sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Derek Parnell wrote:
 On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:
 
 
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; }
LOL.... try this too. writefln("%s %s", !!i, !!k); I get "true false" in return. Now this qualifies as a real D-Geek operator.
ack! this is wrong!! apparently, ! returns a bool
Mar 07 2006
parent BCS <BCS_member pathlink.com> writes:
[snips]
int main()
{
	int k = 0;

	if(!!k)writef("k\n");else writef("!k\n");
LOL.... try this too. writefln("%s %s", !!i, !!k);
ack! this is wrong!! apparently, ! returns a bool
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).
Mar 07 2006
prev sibling parent Wang Zhen <nehzgnaw gmail.com> writes:
Derek Parnell wrote:
 On Tue, 07 Mar 2006 18:12:41 -0800, BCS wrote:
 
 
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; }
LOL.... try this too. writefln("%s %s", !!i, !!k); I get "true false" in return. Now this qualifies as a real D-Geek operator.
This is an old C idiom.
Mar 07 2006
prev sibling parent Niko Korhonen <niktheblak hotmail.com> writes:
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
prev sibling next sibling parent Derek Parnell <derek psych.ward> writes:
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.html
Bloody 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
prev sibling next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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.html
Oh, and opSliceAssign, and the if(type variable = expr) too? Just too good.
Mar 07 2006
prev sibling next sibling parent Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
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
prev sibling next sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
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.html
 
 
 
I could kiss you. 0.150 == 1.0 ? <g>
Mar 07 2006
prev sibling next sibling parent reply Sean Kelly <sean f4.ca> writes:
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
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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...
 Did you mean "are now _the_ only operators allowed on bools?"
Yes. Walter isn't _that_ big of a doof :)
Although a quick test: bool x = true; int y = x * 5; bool z = true / false; Hmm..
Mar 07 2006
prev sibling parent reply Derek Parnell <derek psych.ward> writes:
On Tue, 07 Mar 2006 15:41:28 -0800, Sean Kelly wrote:

 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?"
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 PM
Mar 07 2006
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"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
parent Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Walter Bright wrote:
 "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 :-(
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#D
Mar 08 2006
prev sibling next sibling parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
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
next sibling parent Sean Kelly <sean f4.ca> writes:
Tom S wrote:
 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.
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>
Mar 07 2006
prev sibling parent "Walter Bright" <newshound digitalmars.com> writes:
"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
prev sibling next sibling parent reply David Medlock <noone nowhere.com> writes:
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.html
 
 
Great 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
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"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
next sibling parent David Medlock <noone nowhere.com> writes:
Walter Bright wrote:
 "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.
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. -DavidM
Mar 07 2006
prev sibling parent reply MicroWizard <MicroWizard_member pathlink.com> writes:
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
parent reply Charles Hixson <charleshixsn earthlink.net> writes:
MicroWizard wrote:

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
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 progress
Mar 12 2006
next sibling parent MicroWizard <MicroWizard_member pathlink.com> writes:
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:

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
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 progress
Mar 12 2006
prev sibling parent reply Don Clugston <dac nospam.com.au> writes:
Charles Hixson wrote:
 MicroWizard wrote:
 
 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
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.
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.
Mar 13 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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
parent reply Don Clugston <dac nospam.com.au> writes:
Anders F Björklund wrote:
 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... :-)
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...
 
 --anders
Mar 13 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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... :-)
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...
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! --anders
Mar 13 2006
parent reply Don Clugston <dac nospam.com.au> writes:
Anders F Björklund wrote:
 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... :-)
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...
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 ?
No, but it is a practical problem, which makes it hard to justify the use of D.
 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
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Don Clugston wrote:

 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>.
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 ?
 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
prev sibling next sibling parent John Reimer <terminal.node gmail.com> writes:
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.html
 
 
 
Excellent 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
prev sibling next sibling parent reply Lucas Goss <lgoss007 gmail.com> writes:
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
next sibling parent "Walter Bright" <newshound digitalmars.com> writes:
"Lucas Goss" <lgoss007 gmail.com> wrote in message 
news:dulcq5$8cj$1 digitaldaemon.com...
 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.
LOL. I can't please everybody <g>.
Mar 07 2006
prev sibling next sibling parent Sean Kelly <sean f4.ca> writes:
Lucas Goss wrote:
 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 liked the old form as well. Ah well :-) Sean
Mar 07 2006
prev sibling next sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Lucas Goss wrote:
 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.
What's the inconsistency here?
Mar 07 2006
parent reply Lucas Goss <lgoss007 gmail.com> writes:
Hasan Aljudy wrote:
 Lucas Goss wrote:
 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.
What's the inconsistency here?
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 :)
Mar 08 2006
next sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Lucas Goss wrote:
 Hasan Aljudy wrote:
 
 Lucas Goss wrote:

 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.
What's the inconsistency here?
The inconsistency is in the style of the language. Where else in the language is there a keyword inside another keyword?
while(true) :)
 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
parent reply Lucas Goss <lgoss007 gmail.com> writes:
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?
while(true) :)
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)
 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_worse
Yeah 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
parent Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Lucas Goss wrote:
 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?
while(true) :)
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)
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#D
Mar 09 2006
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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
parent reply Lucas Goss <lgoss007 gmail.com> writes:
Jarrett Billingsley wrote:
 "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")
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();
Mar 08 2006
parent "Derek Parnell" <derek psych.ward> writes:
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
prev sibling next sibling parent reply AgentOrange <AgentOrange_member pathlink.com> writes:
In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...
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.
this especially bites for those of us using scope as an identifier... :(
Mar 07 2006
parent reply Derek Parnell <derek psych.ward> writes:
On Wed, 8 Mar 2006 05:25:29 +0000 (UTC), AgentOrange wrote:

 In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...
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.
this especially bites for those of us using scope as an identifier... :(
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 PM
Mar 07 2006
next sibling parent AgentOrange <AgentOrange_member pathlink.com> writes:
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...
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.
this especially bites for those of us using scope as an identifier... :(
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 PM
Mar 07 2006
prev sibling next sibling parent reply Wang Zhen <nehzgnaw gmail.com> writes:
Derek Parnell wrote:
 On Wed, 8 Mar 2006 05:25:29 +0000 (UTC), AgentOrange wrote:
 
 
In article <dulcq5$8cj$1 digitaldaemon.com>, Lucas Goss says...

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.
this especially bites for those of us using scope as an identifier... :(
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.
Avoid English words. Problem solved.
Mar 07 2006
parent MicroWizard <MicroWizard_member pathlink.com> writes:
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
prev sibling parent reply Mark T <Mark_member pathlink.com> writes:
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
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----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
parent reply Sean Kelly <sean f4.ca> writes:
Thomas Kuehne wrote:
 

 
 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;
    }
 }
What a wonderful language :-p What does the ' ' represent? Sean
Mar 11 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sean Kelly schrieb am 2006-03-11:
 Thomas Kuehne wrote:
 

 
 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;
    }
 }
What a wonderful language :-p What does the ' ' represent?
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-----
Mar 12 2006
prev sibling next sibling parent Chris Sauls <ibisbasenji gmail.com> writes:
Lucas Goss wrote:
 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.
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-Sauls
Mar 08 2006
prev sibling parent Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Lucas Goss wrote:
 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.
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#D
Mar 09 2006
prev sibling next sibling parent Wang Zhen <nehzgnaw gmail.com> writes:
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.html
 
 
 
Great work, Walter! I'll throw out more bizarre test cases to help you perfect dmd ;)
Mar 07 2006
prev sibling next sibling parent reply BCS <BCS_member pathlink.com> writes:
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
next sibling parent reply Derek Parnell <derek psych.ward> writes:
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
next sibling parent BCS <BCS_member pathlink.com> writes:
Derek Parnell wrote:
 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>
C compiler? Now where did I put that thing? :P
Mar 07 2006
prev sibling parent reply jicman <jicman_member pathlink.com> writes:
Derek Parnell says...
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>
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?
Mar 13 2006
parent reply "Regan Heath" <regan netwin.co.nz> writes:
On Tue, 14 Mar 2006 01:07:43 +0000 (UTC), jicman  
<jicman_member pathlink.com> wrote:

 Derek Parnell says...
 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>
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?
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 :) Regan
Mar 13 2006
parent jicman <jicman_member pathlink.com> writes:
Thanks. :-)

Regan Heath says...
On Tue, 14 Mar 2006 01:07:43 +0000 (UTC), jicman  
<jicman_member pathlink.com> wrote:

 Derek Parnell says...
 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>
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?
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 :) Regan
Mar 13 2006
prev sibling parent reply "Walter Bright" <newshound digitalmars.com> writes:
"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
parent BCS <BCS_member pathlink.com> writes:
In article <duli9p$fl0$4 digitaldaemon.com>, Walter Bright says...
"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.
Just a list of the function in the docs would be nice, one line of description would be terrific.
Mar 07 2006
prev sibling next sibling parent Brad Roberts <braddr puremagic.com> writes:
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.html
For 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
prev sibling next sibling parent Don Clugston <dac nospam.com.au> writes:
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
prev sibling next sibling parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
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.html
 
Wow, great work Walter :)
Mar 08 2006
prev sibling parent reply Kevin Bealer <Kevin_member pathlink.com> writes:
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.html
Excellent! 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
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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