Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-10 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 19:54:47 UTC, H. S. Teoh via Digitalmars-d-learn wrote: [...] The problem is that the function needs to return int, but given two uints, their difference may be greater than int.max, so simply subtracting them will not work. So the best I can come up with is:

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-10 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
Should of course be: int compare2(uint x, int y) { return (x int.max) ? 1 : (cast(int)x - y); }

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-10 Thread JR via Digitalmars-d-learn
On Monday, 7 July 2014 at 23:47:26 UTC, Aerolite wrote: So, if you would be so kind, give me a bullet list of the aspects of D you believe to be good, awesome, bad, and/or ugly. If you have the time, some code examples wouldn't go amiss either! Try not to go in-depth to weird edge cases -

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 09, 2014 at 07:51:24AM +0200, Philippe Sigaud via Digitalmars-d-learn wrote: On Tue, Jul 8, 2014 at 7:50 AM, H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote quite a wall of text Wow, what to add to that? Maybe you scared other from participating ;-) I

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread Meta via Digitalmars-d-learn
On Monday, 7 July 2014 at 23:47:26 UTC, Aerolite wrote: Hey all, I've not posted here in a while, but I've been keeping up to speed with D's progress over the last couple of years and remain consistently impressed with the language. I'm part of a new computing society in the University of

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote: One of the uglier things in D is also a long-standing problem with C and C++, in that comparison of signed and unsigned values is allowed. I would like that, if it would be implemented along this line: /// Returns -1 if a b, 0 if they

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
Of course without the ! after opCmp in the several cases.

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote: On Wednesday, 9 July 2014 at 14:51:41 UTC, Meta wrote: One of the uglier things in D is also a long-standing problem with C and C++, in that comparison of signed and unsigned values is allowed.

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Wed, Jul 09, 2014 at 04:24:38PM +, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote: /// Returns -1 if a b, 0 if they are equal or 1 if a b. /// this will always yield a correct result, no matter

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread anonymous via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: For the comparison s u, where s is a signed value and u is an unsigned value, whenever s is negative, the return value of opCmp must be negative. Assuming 2's-complement representation of integers, this

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: The branched version would look something like this: mov eax, [address of u] mov ebx, [address of s] cmp ebx, $#0 jge label1 ; first branch mov

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote: On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: [..] Yeah, I don't see what's the problem with comparing signed and unsigned values, as long as the result is

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jul 09, 2014 at 11:29:06AM -0700, H. S. Teoh via Digitalmars-d-learn wrote: On Wed, Jul 09, 2014 at 05:43:15PM +, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote: On Wednesday, 9 July 2014 at 17:13:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: [...] Often, such

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-08 Thread Philippe Sigaud via Digitalmars-d-learn
On Tue, Jul 8, 2014 at 7:50 AM, H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote quite a wall of text Wow, what to add to that? Maybe you scared other from participating ;-) * I'll second metaprogramming: the alliance between templates, CTFE and mixins is really nice.

Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-07 Thread Aerolite via Digitalmars-d-learn
Hey all, I've not posted here in a while, but I've been keeping up to speed with D's progress over the last couple of years and remain consistently impressed with the language. I'm part of a new computing society in the University of Newcastle, Australia, and am essentially known throughout

Re: Opinions: The Best and Worst of D (for a lecture/talk I intend to give)

2014-07-07 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jul 07, 2014 at 11:47:25PM +, Aerolite via Digitalmars-d-learn wrote: [...] So, if you would be so kind, give me a bullet list of the aspects of D you believe to be good, awesome, bad, and/or ugly. If you have the time, some code examples wouldn't go amiss either! Try not to go