Re: D's SwitchStatement accepts statements with ridiculous semantics

2017-09-29 Thread Don Clugston via Digitalmars-d
On Friday, 29 September 2017 at 10:32:02 UTC, Timon Gehr wrote: On 29.09.2017 11:12, Don Clugston wrote: Guess what this prints import std.stdio; void main() {   int i = 0;   switch (i) for (i = 8; i < 10; ++i)   {     case 7:     writeln(i);     return;     defa

D's SwitchStatement accepts statements with ridiculous semantics

2017-09-29 Thread Don Clugston via Digitalmars-d
Guess what this prints import std.stdio; void main() { int i = 0; switch (i) for (i = 8; i < 10; ++i) { case 7: writeln(i); return; default: ; } } Why does this even compile? It's because the grammar is: SwitchStatement: switch ( Expression )

Re: Exception chaining and collectException

2017-08-18 Thread Don Clugston via Digitalmars-d
On Friday, 18 August 2017 at 03:31:38 UTC, Walter Bright wrote: Chained exceptions are a good idea, but are more or less a disaster: 1. No other language does chained exceptions 2. Attempting to hammer D chained exceptions into other language schemes (such as C++) makes for lots of unfun

Re: Battle-plan for CTFE

2016-05-17 Thread Don Clugston via Digitalmars-d-announce
On Sunday, 15 May 2016 at 12:17:30 UTC, Daniel Murphy wrote: On 15/05/2016 9:57 PM, Martin Nowak wrote: On 05/15/2016 01:58 PM, Daniel Murphy wrote: The biggest advantage of bytecode is not the interpreter speed, it's that by lowering you can substitute VarExps etc with actual references to

Re: Battle-plan for CTFE

2016-05-13 Thread Don Clugston via Digitalmars-d-announce
On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote: Hi Guys, I have been looking into the DMD now to see what I can do about CTFE. Unfortunately It is a pretty big mess to untangle. Code responsible for CTFE is in at least 3 files. [dinterpret.d, ctfeexpr.d, constfold.d] I was shocked

D's Greatest Bugbear

2012-12-18 Thread Don Clugston
Bearophile has just entered his 1000th bug report into Bugzilla. This is more than the three next most prolific contributers, combined. The top ten bug reporters are (courtesy of Deskzilla): 1002 Bearophile 315 Andrej Mitrovic 308 Don Clugston 282 David Simcha 193 Andrei Alexandrescu 185

Re: half datatype?

2012-11-20 Thread Don Clugston
On 18/11/12 12:21, Manu wrote: I've often wondered about having an official 'half' type. It's very common in rendering/image processing, supported by most video cards (so compression routines interacting with this type are common), and it's also supported in hardware by some cpu's. ARM for

Re: A simple question

2012-11-16 Thread Don Clugston
On 16/11/12 05:15, Rob T wrote: On Friday, 16 November 2012 at 03:41:45 UTC, Stugol wrote: Event_t e2;// Will compile! Yeah but that kinda blows, doesn't it? I found it surprising or unintuitive that the !() is required, and I do want to know what is the reasoning behind it, One

Re: What's the deal with __thread?

2012-11-15 Thread Don Clugston
On 14/11/12 23:16, Walter Bright wrote: On 11/14/2012 12:06 PM, Sean Kelly wrote: On Nov 14, 2012, at 6:26 AM, Don Clugston d...@nospam.com wrote: IIRC it was used prior to 2.030. In the spec, it is in the keyword list, and it's also listed in the Migrating to shared article. That's all

Re: What's the deal with __thread?

2012-11-15 Thread Don Clugston
On 15/11/12 11:54, Walter Bright wrote: On 11/15/2012 2:28 AM, Don Clugston wrote: However, there is one case in the test suite which is unclear to me: extern(C) __thread int x; Is there any other way to do this? extern(C) int x; What about extern(C) variables which are not thread local

Re: hashed array?

2012-11-14 Thread Don Clugston
On 12/11/12 20:42, Jonathan M Davis wrote: On Monday, November 12, 2012 11:36:38 H. S. Teoh wrote: I contend that the problem with built-in AA's is their implementation, not the fact that they're built-in. Oh, I agree, but we, as a group, have obviously failed to handle the implementation of

What's the deal with __thread?

2012-11-14 Thread Don Clugston
IIRC it was used prior to 2.030. In the spec, it is in the keyword list, and it's also listed in the Migrating to shared article. That's all. There are a small number of uses of it in the DMD test suite. Is it still valid? Is it useful? Or has everyone forgotten that it still exists?

Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile)

2012-11-13 Thread Don Clugston
On 13/11/12 06:51, Rob T wrote: On Monday, 12 November 2012 at 14:28:53 UTC, Andrej Mitrovic wrote: On 11/12/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 11/12/12, Don Clugston d...@nospam.com wrote: Yeah. Though note that 1000 bug reports are from bearophile. Actually only

Re: Compilable Recursive Data Structure ( was: Recursive data structure using template won't compile)

2012-11-12 Thread Don Clugston
On 10/11/12 08:53, Rob T wrote: On Saturday, 10 November 2012 at 06:09:41 UTC, Nick Sabalausky wrote: I've gone ahead and filed a minimized test case, and also included your workaround: http://d.puremagic.com/issues/show_bug.cgi?id=8990 I didn't make that one struct nested since that's not

Re: deprecate deprecated?

2012-11-08 Thread Don Clugston
On 07/11/12 00:56, Walter Bright wrote: I know there's been some long term unhappiness about the deprecated attribute - it's all-or-nothing approach, poor messages, etc. Each change in it changes the language and the compiler. Perhaps it could be done with a user defined attribute instead?

Re: a small study of deprecate

2012-11-08 Thread Don Clugston
On 07/11/12 14:16, monarch_dodra wrote: There is some talk going on right now of changing deprecate into a UDA. There are some people saying that deprecate is broken, and proposing some fixes (myself included). Instead of concentrating on how to fix it, and like to first study what is broken.

Re: One old problem with associative arrays

2012-11-07 Thread Don Clugston
On 07/11/12 05:38, H. S. Teoh wrote: On Wed, Nov 07, 2012 at 05:08:43AM +0100, bearophile wrote: [...] So the associative array is updated before taking its length. I suggest to try to fix this AA behavour before too much D2 code relies on this. I'd like to avoid this to become a permanent wart

Re: D is a cool language!

2012-11-05 Thread Don Clugston
On 04/11/12 15:30, stonemaster wrote: On Thursday, 1 November 2012 at 15:56:24 UTC, Tobias Pankrath wrote: On Thursday, 1 November 2012 at 15:20:11 UTC, Andrei Alexandrescu wrote: On 11/1/12 9:47 AM, Paulo Pinto wrote: Hi everyone, I just saw this online. The German magazine c't kompakt

Re: Simple implementation of __FUNCTION

2012-11-05 Thread Don Clugston
On 06/11/12 07:09, Rob T wrote: On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote: I discovered it fails to compile when inside a function with auto as the return type. auto test() { throw new Exception( mixin(__FUNCTION) ); return 0; } Error: forward reference to test but this

Re: A little Py Vs C++

2012-11-02 Thread Don Clugston
On 02/11/12 09:07, Jacob Carlborg wrote: On 2012-11-01 23:51, Walter Bright wrote: What about all your feature requests? I think you've made more than anyone, by a factor of 10 at least! :-) As for Manu's request http://d.puremagic.com/issues/show_bug.cgi?id=8108 I've gone over with him

Re: A little Py Vs C++

2012-11-02 Thread Don Clugston
On 02/11/12 10:12, Jens Mueller wrote: Don Clugston wrote: On 02/11/12 09:07, Jacob Carlborg wrote: On 2012-11-01 23:51, Walter Bright wrote: What about all your feature requests? I think you've made more than anyone, by a factor of 10 at least! :-) As for Manu's request http

Re: A little Py Vs C++

2012-11-02 Thread Don Clugston
On 02/11/12 10:01, Jens Mueller wrote: Jacob Carlborg wrote: On 2012-11-01 23:51, Walter Bright wrote: What about all your feature requests? I think you've made more than anyone, by a factor of 10 at least! :-) As for Manu's request http://d.puremagic.com/issues/show_bug.cgi?id=8108 I've

Re: To take a part in development

2012-11-02 Thread Don Clugston
On 02/11/12 14:04, Habibutsu wrote: I would like to take a part in development of D programming language or Phobos library. I opened bugtracker and found some bugs that i could to fix. Maybe I should read something (specifically for development) or you can give me some advice before i create

Re: A little Py Vs C++

2012-11-02 Thread Don Clugston
On 02/11/12 11:57, Jens Mueller wrote: Peter Alexander wrote: On Friday, 2 November 2012 at 10:24:34 UTC, Jens Mueller wrote: Then I have a serious misunderstanding. I thought D introduced array operations to allow the compiler to generate efficient vector operations (in the long run), i.e.

Re: vestigial delete in language spec

2012-11-02 Thread Don Clugston
On 01/11/12 22:21, Dan wrote: TDPL states -- However, unlike in C++, clear does not dispose of the object’s own memory and there is no delete operator. (D used to have a delete operator, but it was deprecated.) You still can free memory manually if you really, really know what you’re doing

Re: assert(false, ...) doesn't terminate program?!

2012-10-30 Thread Don Clugston
On 29/10/12 18:38, Walter Bright wrote: On 10/29/2012 7:51 AM, Don Clugston wrote: On 27/10/12 20:39, H. S. Teoh wrote: On Sat, Oct 27, 2012 at 08:26:21PM +0200, Andrej Mitrovic wrote: On 10/27/12, H. S. Teoh hst...@quickfur.ath.cx wrote: writeln(how did the assert not trigger

Re: __traits(compiles,...) = ? is(typeof(...))

2012-10-30 Thread Don Clugston
On 29/10/12 12:03, Jonathan M Davis wrote: On Monday, October 29, 2012 11:42:59 Zhenya wrote: Hi! Tell me please,in this code first and second static if,are these equivalent? with arg = 1, __traits(compiles,check(arg);) = true, is(typeof(check(arg))) = false. In principle, is(typeof(code))

Re: Copying with immutable arrays

2012-10-30 Thread Don Clugston
On 29/10/12 07:19, Ali Çehreli wrote: On 10/28/2012 02:37 AM, Tobias Pankrath wrote: the struct SwA from above does neither correspond to SA nor to SB, it's imo more like SC: struct SC { immutable(int)* i; } Just to confirm, the above indeed works: struct SC {

Re: Another day in the ordeal of cartesianProduct

2012-10-29 Thread Don Clugston
On 27/10/12 00:45, H. S. Teoh wrote: http://d.puremagic.com/issues/show_bug.cgi?id=8900 :-( (The code there is called cartesianProd but it's the reduced code, so it doesn't really compute the cartesian product. But that's where it's from.) So far, the outstanding blockers for cartesianProduct

Re: assert(false, ...) doesn't terminate program?!

2012-10-29 Thread Don Clugston
On 27/10/12 20:39, H. S. Teoh wrote: On Sat, Oct 27, 2012 at 08:26:21PM +0200, Andrej Mitrovic wrote: On 10/27/12, H. S. Teoh hst...@quickfur.ath.cx wrote: writeln(how did the assert not trigger??!!); // how did we get here?! Maybe related to -release? [...] Haha, you're

Re: Very simple SIMD programming

2012-10-24 Thread Don Clugston
On 24/10/12 04:41, bearophile wrote: I have found a nice paper, Extending a C-like Language for Portable SIMD Programming, (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/projects/vecimp/vecimp_tr.pdf They present a simple scalar program in C: struct

Re: [proposal] version statements with multiple arguments.

2012-10-24 Thread Don Clugston
On 23/10/12 05:17, 1100110 wrote: Looking at std.io (hopefully the right version maybe?) I see this: version(OSX) { do something; } version(Windows) { do the same thing as above; } version(FreeBSD) { ditto; } version(Linux) {finally do something different; } and:

Re: Very simple SIMD programming

2012-10-24 Thread Don Clugston
On 24/10/12 11:33, Timon Gehr wrote: On 10/24/2012 11:24 AM, Don Clugston wrote: On 24/10/12 04:41, bearophile wrote: I have found a nice paper, Extending a C-like Language for Portable SIMD Programming, (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de

Re: long compile time question

2012-10-24 Thread Don Clugston
On 24/10/12 17:39, thedeemon wrote: On Wednesday, 24 October 2012 at 03:50:47 UTC, Dan wrote: The following takes nearly three minutes to compile. The culprit is the line bar ~= B(); What is wrong with this? Thanks, Dan struct B { const size_t SIZE = 1024*64; int[SIZE] x;

Re: How mutable is immutable?

2012-10-22 Thread Don Clugston
On 18/10/12 19:43, Timon Gehr wrote: On 10/18/2012 10:08 AM, Don Clugston wrote: On 17/10/12 18:02, Timon Gehr wrote: On 10/17/2012 01:49 PM, Don Clugston wrote: ... That's the point -- *which* checks are missing from @safe? Escaping stack data and arbitrarily freeing memory

Re: D seems interesting, but...

2012-10-22 Thread Don Clugston
On 15/10/12 13:39, Jacob Carlborg wrote: On 2012-10-15 11:58, Don Clugston wrote: I tried that on both Windows and Ubuntu, and couldn't get it to work on either of them. I posted a couple of bug reports eight months ago, and they still haven't been fixed. Not recommended for anyone who

Re: Regarding hex strings

2012-10-19 Thread Don Clugston
On 18/10/12 17:43, foobar wrote: On Thursday, 18 October 2012 at 14:29:57 UTC, Don Clugston wrote: On 18/10/12 10:58, foobar wrote: On Thursday, 18 October 2012 at 02:47:42 UTC, H. S. Teoh wrote: On Thu, Oct 18, 2012 at 02:45:10AM +0200, bearophile wrote: [...] hex strings are useful, but I

Re: Regarding hex strings

2012-10-19 Thread Don Clugston
On 19/10/12 16:07, foobar wrote: On Friday, 19 October 2012 at 13:19:09 UTC, Don Clugston wrote: We can still have both (assuming the code points are valid...): string foo = \ua1\ub2\uc3; // no .dup That doesn't compile. Error: escape hex sequence has 2 hex digits instead of 4 Come

Re: Tricky semantics of ranges potentially numerous Phobos bugs

2012-10-18 Thread Don Clugston
On 17/10/12 23:41, H. S. Teoh wrote: On Wed, Oct 17, 2012 at 12:55:56PM -0700, Jonathan M Davis wrote: [...] I'm increasingly convinced that input ranges which are not forward ranges are useless for pretty much anything other than foreach. Far too much requires that you be able to save the

Re: How mutable is immutable?

2012-10-18 Thread Don Clugston
On 17/10/12 18:02, Timon Gehr wrote: On 10/17/2012 01:49 PM, Don Clugston wrote: On 01/01/12 13:50, Timon Gehr wrote: On 01/01/2012 10:40 AM, Denis Shelomovskij wrote: So, I'm a function `f`, I have an `immutable(type)[]` argument and I want to store it for my friend `g` in an TLS variable `v

Re: Bits rotations

2012-10-18 Thread Don Clugston
On 18/10/12 11:39, Iain Buclaw wrote: On 18 October 2012 09:27, bearophile bearophileh...@lycos.com wrote: Iain Buclaw: In the gdc-4.6 package you have there, it's only naked asm that can't be inlined. Good. However it is worth noting that DIASM is no longer in mainline gdc. What's

Re: Regarding hex strings

2012-10-18 Thread Don Clugston
On 18/10/12 10:58, foobar wrote: On Thursday, 18 October 2012 at 02:47:42 UTC, H. S. Teoh wrote: On Thu, Oct 18, 2012 at 02:45:10AM +0200, bearophile wrote: [...] hex strings are useful, but I think they were invented in D1 when strings were convertible to char[]. But today they are an array

Re: How mutable is immutable?

2012-10-17 Thread Don Clugston
On 01/01/12 13:50, Timon Gehr wrote: On 01/01/2012 10:40 AM, Denis Shelomovskij wrote: So, I'm a function `f`, I have an `immutable(type)[]` argument and I want to store it for my friend `g` in an TLS variable `v`: --- string v; debug string sure; void f(string s) { v = s; debug sure = s.idup;

Re: alias A = B; syntax

2012-10-16 Thread Don Clugston
On 16/10/12 05:18, Nick Sabalausky wrote: On Tue, 16 Oct 2012 05:00:56 +0200 stas stas...@yahoo.com wrote: For me syntax alias int Int; seems unnatural. I'd love to write alias Int = int; alias fptr = void(int)*; This looks much more readable for me and harmonized with int x = 0; template

Re: D seems interesting, but...

2012-10-15 Thread Don Clugston
On 15/10/12 06:42, Jonathan M Davis wrote: On Sunday, October 14, 2012 21:39:42 H. S. Teoh wrote: This looks like what happens if you try to use the latest dmd release with an old version of Phobos, perhaps installed along with gdc. Whoever's doing the .deb packaging really should add a

Re: D seems interesting, but...

2012-10-15 Thread Don Clugston
On 15/10/12 11:14, Jacob Carlborg wrote: Just use DVM, it's also cross-platform: https://bitbucket.org/doob/dvm I tried that on both Windows and Ubuntu, and couldn't get it to work on either of them. I posted a couple of bug reports eight months ago, and they still haven't been fixed. Not

Re: Why are scope variables being deprecated?

2012-10-11 Thread Don Clugston
On 11/10/12 02:30, Piotr Szturmaj wrote: Jonathan M Davis wrote: On Thursday, October 11, 2012 01:24:40 Piotr Szturmaj wrote: Could you give me an example of preventing closure allocation? I think I knew one but I don't remember now... Any time that a delegate parameter is marked as scope,

Re: next_permutation and cartesian product for ranges?

2012-10-10 Thread Don Clugston
On 10/10/12 00:22, bearophile wrote: Steven Schveighoffer: Is there any advantage over having a function? I'd think you could easily build a range based on the function, no? Generators (that yield lexicographic permutations, permutation swaps, combinations, etc) are quite more handy, you

Re: What is the case against a struct post-blit default constructor?

2012-10-10 Thread Don Clugston
On 10/10/12 11:21, Jonathan M Davis wrote: On Monday, October 08, 2012 18:47:43 Malte Skarupke wrote: So I really can't think of a reason for why you wouldn't want this. Yet this discussion has happened several times already. There is clear demand for it and very good reasons, such as those

Re: What is the case against a struct post-blit default constructor?

2012-10-10 Thread Don Clugston
On 10/10/12 13:27, Timon Gehr wrote: On 10/10/2012 12:45 PM, Don Clugston wrote: On 10/10/12 11:21, Jonathan M Davis wrote: On Monday, October 08, 2012 18:47:43 Malte Skarupke wrote: So I really can't think of a reason for why you wouldn't want this. Yet this discussion has happened several

Re: Error messages for newbies survey

2012-10-10 Thread Don Clugston
On 10/10/12 14:09, bearophile wrote: From Reddit, a nice survey: http://www.reddit.com/r/coding/comments/118ssp/honours_student_at_my_university_is_doing_a/ For my Computer Science Honours research project, I am currently investigating ways of improving the terse, technical error messages

Re: Best way of passing in a big struct to a function?

2012-10-10 Thread Don Clugston
On 10/10/12 09:12, thedeemon wrote: On Wednesday, 10 October 2012 at 07:28:55 UTC, Jonathan M Davis wrote: Making sure that the aa has been properly initialized before passing it to a function (which would mean giving it at least one value) would make the ref completely unnecessary. - Jonathan

Re: D 1.076 Alpha for Windows 64 bits, works with VS 2010

2012-10-09 Thread Don Clugston
On 06/10/12 20:38, Walter Bright wrote: On 9/30/2012 9:35 PM, Andrej Mitrovic wrote: On 10/1/12, Walter Bright newshou...@digitalmars.com wrote: Also, consider that in C++ you can throw any type, such as an int. There is no credible way to make this work reasonably in D, as exceptions are all

Re: Feature request: extending comma operator's functionality

2012-10-08 Thread Don Clugston
On 05/10/12 18:58, H. S. Teoh wrote: On Fri, Oct 05, 2012 at 05:23:40PM +0200, Don Clugston wrote: [...] My feeling is that do{}while() is a fairly useless concept, and this is part of the reason. In my experience genuine do-while loops are extremely rare, and it only takes a slight change

Re: Feature request: extending comma operator's functionality

2012-10-05 Thread Don Clugston
On 05/10/12 15:35, monarch_dodra wrote: On Friday, 5 October 2012 at 00:22:04 UTC, Jonathan M Davis wrote: On Friday, October 05, 2012 02:08:14 bearophile wrote: [SNIP] Regarding definition of variables in D language constructs, there is one situation where sometimes I find D not handy. This

Re: Proposal: clean up semantics of array literals vs string literals

2012-10-04 Thread Don Clugston
On 02/10/12 17:14, Andrei Alexandrescu wrote: On 10/2/12 7:11 AM, Don Clugston wrote: The problem --- String literals in D are a little bit magical; they have a trailing \0. [snip] I don't mean to be Debbie Downer on this because I reckon it addresses an issue that some have

Re: It seems pure ain't so pure after all

2012-10-02 Thread Don Clugston
On 01/10/12 07:40, Tommi wrote: import std.stdio; int pow2(int val) pure { if (__ctfe) return 6; else return val * val; } void main() { assert(pow2(3) == 9); static assert(pow2(3) == 6); writeln(9 = 6 ... I knew it! '6' was faking it all

Proposal: clean up semantics of array literals vs string literals

2012-10-02 Thread Don Clugston
The problem --- String literals in D are a little bit magical; they have a trailing \0. This means that is possible to write, printf(Hello, World!\n); without including a trailing \0. This is important for compatibility with C. This trailing \0 is mentioned in the spec but only

Re: Proposal: clean up semantics of array literals vs string literals

2012-10-02 Thread Don Clugston
On 02/10/12 14:02, Andrej Mitrovic wrote: On 10/2/12, Don Clugston d...@nospam.com wrote: A proposal to clean up this mess Any compile-time value of type immutable(char)[] or const(char)[], behaves a string literals currently do, and will have a \0 appended

Re: Proposal: clean up semantics of array literals vs string literals

2012-10-02 Thread Don Clugston
On 02/10/12 13:26, deadalnix wrote: Well the whole mess come from the fact that D conflate C string and D string. The first problem come from the fact that D array are implicitly convertible to pointer. So calling D function that expect a char* is possible with D string even if it is unsafe and

Re: Proposal: clean up semantics of array literals vs string literals

2012-10-02 Thread Don Clugston
On 02/10/12 13:18, Tobias Pankrath wrote: On Tuesday, 2 October 2012 at 11:10:46 UTC, Don Clugston wrote: The problem --- String literals in D are a little bit magical; they have a trailing \0. This means that is possible to write, printf(Hello, World!\n); without including

Re: Is it possible to force CTFE?

2012-10-01 Thread Don Clugston
On 27/09/12 15:01, bearophile wrote: Tommi: 2) Is it possible to specialize a function based on whether or not the parameter that was passed in is a compile time constant? I am interested in this since some years. I think it's useful, but I don't know if it can be implemented. I don't

Re: About std.ascii.toLower

2012-09-27 Thread Don Clugston
On 20/09/12 18:57, Jonathan M Davis wrote: On Thursday, September 20, 2012 18:35:21 bearophile wrote: monarch_dodra: It's not, it only *operates* on ASCII, but non ascii is still a legal arg: Then maybe std.ascii.toLower needs a pre-condition that constraints it to just ASCII inputs, so

Re: Should this be flagged as a warning?

2012-09-26 Thread Don Clugston
On 25/09/12 21:30, Bernard Helyer wrote: I tried to post this last night, but the NG wasn't having any of it. I found myself writing a bug that looked like this match(ts, TokenType.Is); match(ts, TokenType.OpenParen); isExp.type == parseType(ts); The bug being of course, that a

Re: Order of evaluation - aka hidden undefined behaviours.

2012-09-26 Thread Don Clugston
On 26/09/12 01:31, H. S. Teoh wrote: On Wed, Sep 26, 2012 at 01:10:00AM +0200, Timon Gehr wrote: On 09/26/2012 12:58 AM, Iain Buclaw wrote: [...] string abc; float[] A() { abc ~= A; return []; } float[] B() { abc ~= B; return []; } float[] C() { abc ~= C;

Re: Should this be flagged as a warning?

2012-09-26 Thread Don Clugston
On 26/09/12 14:19, Timon Gehr wrote: On 09/26/2012 11:45 AM, Don Clugston wrote: On 25/09/12 21:30, Bernard Helyer wrote: I tried to post this last night, but the NG wasn't having any of it. I found myself writing a bug that looked like this match(ts, TokenType.Is); match(ts

Re: std.math.frexp wrong on ARM

2012-09-26 Thread Don Clugston
On 26/09/12 17:13, Johannes Pfau wrote: The frexp test fails on ARM. I think the mask in line 1491 is wrong: https://github.com/D-Programming-Language/phobos/blob/master/std/math.d#L1491 For doubles, the 63 bit is sign, 62-52 are exponent and 51-0 are mantissa. The mask manipulates the bits

Re: function is not function

2012-09-26 Thread Don Clugston
On 21/09/12 21:59, Ellery Newcomer wrote: solution is to use std.traits, but can someone explain this to me? import std.stdio; void main() { auto a = { writeln(hi); }; pragma(msg, typeof(a)); // void function() pragma(msg, is(typeof(a) == delegate)); // nope!

Re: object.error: Privileged Instruction

2012-09-26 Thread Don Clugston
On 22/09/12 21:49, Jonathan M Davis wrote: On Saturday, September 22, 2012 21:19:27 Maxim Fomin wrote: Privilege instruction is an assembly instruction which can be executed only at a certain executive process context, typically os kernel. AFAIK assert(false) was claimed to be implemented by

Re: DIP19: Remove comma operator from D and provision better syntactic support for tuples

2012-09-25 Thread Don Clugston
On 24/09/12 17:19, Andrei Alexandrescu wrote: On 9/24/12 4:17 AM, Don Clugston wrote: Regarding the comma operator: I'd love to deprecate it, but even if we don't, could we at least ensure that this kind of rubbish doesn't compile: void main() { int x; x 0, x += 5; } At present, because

Re: DIP19: Remove comma operator from D and provision better syntactic support for tuples

2012-09-24 Thread Don Clugston
On 23/09/12 22:40, Andrei Alexandrescu wrote: I discussed this with Walter, and we concluded that we could deprecate the comma operator if it helps tuples. So I started with this: http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP19 Unfortunately, I started much cockier than I

Re: no-arg constructor for structs (again)

2012-09-20 Thread Don Clugston
On 20/09/12 11:09, Jonathan M Davis wrote: On Thursday, September 20, 2012 10:11:41 Felix Hufnagel wrote: On Thursday, 20 September 2012 at 00:14:04 UTC, Jonathan M Davis wrote: On Thursday, September 20, 2012 00:12:04 Felix Hufnagel wrote: isn't it even worse? import std.stdio; struct S {

Re: Struct problems

2012-09-18 Thread Don Clugston
On 17/09/12 20:47, Maxim Fomin wrote: I consider current struct creation one of the confusing parts of the language (may be the most), due to set of incompatible creation semantics masked by same syntax, complicated by couple of semi-bugs (7210, 1310, 4053) and naive default arguments embedding

Re: About default parameters in variadic templates

2012-09-18 Thread Don Clugston
On 17/09/12 14:42, Andrej Mitrovic wrote: Related: http://d.puremagic.com/issues/show_bug.cgi?id=8676 A lot of code could be stripped if there was a way to set an optional last parameter for variadics. lockstep could then be written as: auto newLockstep(Args...)(Args args, StoppingPolicy

Re: [OT] Was: totally satisfied :D

2012-09-18 Thread Don Clugston
On 18/09/12 09:29, Walter Bright wrote: I suppose I have a more pragmatic view, due to my background in non-computer engineering. It's all like that. There are a couple of good reasons for that. 1. Not every engineer is a rock star. In fact, very few of them are. I tend to snicker at

Re: built-in array ptrEnd

2012-09-18 Thread Don Clugston
On 17/09/12 18:40, bearophile wrote: monarch_dodra: IMO, this should really be built-in, in particular, since, in my understanding, an array is internally represented by the ptr and ptrEnd pair anyways. Currently this is not true, take a look at the ABI part in the D site. Currently it's a

Re: [Issue 8660] New: Unclear semantics of array literals of char type, vs string literals

2012-09-14 Thread Don Clugston
On 14/09/12 14:50, monarch_dodra wrote: On Friday, 14 September 2012 at 11:28:04 UTC, Don wrote: --- Comment #0 from Don clugd...@yahoo.com.au 2012-09-14 04:28:17 PDT --- Array literals of char type, have completely different semantics from string literals. In module scope: char[] x = ['a'];

Re: LDC

2012-09-13 Thread Don Clugston
On 05/09/12 20:12, Jacob Carlborg wrote: On 2012-09-05 14:32, Piotr Szturmaj wrote: angel wrote: Check out LDC web-page ... In github we see they're up to date - merging 2.060 What's the status of SEH on Windows? It's not looking good, at least not for 32bit. Borland has some kind of

Re: filter out compile error messages involving _error_

2012-09-10 Thread Don Clugston
On 10/09/12 02:31, Jonathan M Davis wrote: On Monday, September 10, 2012 02:16:19 Timon Gehr wrote: Don has expressed the desire to weed those out completely. If he can do it in a way that leaves in all of the necessary information, then great, but you need to be able to know what the

Re: bigint - python long

2012-09-06 Thread Don Clugston
On 05/09/12 21:23, Paul D. Anderson wrote: On Wednesday, 5 September 2012 at 18:13:40 UTC, Ellery Newcomer wrote: Hey. Investigating the possibility of providing this conversion in pyd. Python provides an api for accessing the underlying bytes. std.bigint seemingly doesn't. Am I missing

Re: How to have strongly typed numerical values?

2012-09-05 Thread Don Clugston
On 05/09/12 03:42, bearophile wrote: Nicholas Londey: for example degrees west and kilograms such that they cannot be accidentally mixed in an expression. Using the static typing to avoid similar bugs is the smart thing to do :-) I'd be interested to know if that idea is ever used in real

Re: Can DMD be built with g++?

2012-09-04 Thread Don Clugston
On 30/08/12 22:21, Andrej Mitrovic wrote: On 8/30/12, Alex Rønne Petersen a...@lycus.org wrote: How are you building, what platform, etc... Ah geez I forgot there's a makefile (doh!), I need to look into passing the right flags first. I'm trying this on win32 via MinGW btw. That's a

Re: Trouble creating a formatted assert wrapper

2012-09-04 Thread Don Clugston
On 03/09/12 23:48, Chris Nicholson-Sauls wrote: On Monday, 3 September 2012 at 11:17:39 UTC, Chris Nicholson-Sauls wrote: 1) Empty array stands in for empty variadic. [snip] In reality, though, we have neither of these things. [snip] Turns out, I was quite wrong, and I'm happy to be. Empty

Re: Trouble creating a formatted assert wrapper

2012-09-04 Thread Don Clugston
On 04/09/12 11:43, Chris Nicholson-Sauls wrote: On Tuesday, 4 September 2012 at 09:24:26 UTC, Don Clugston wrote: On 03/09/12 23:48, Chris Nicholson-Sauls wrote: I reiterate my impression that magical __FILE__ and __LINE__ should be provided by some other means. It was a special-case hack

Re: handful and interval

2012-09-03 Thread Don Clugston
On 02/09/12 22:42, SomeDude wrote: On Sunday, 2 September 2012 at 15:09:50 UTC, deadalnix wrote: Le 02/09/2012 16:51, Jacob Carlborg a écrit : I really don't like the name handful. What would be the difference compared to a regular set container? To me it sounds like we should have a standard

Re: alias this

2012-09-03 Thread Don Clugston
On 01/09/12 15:16, Carl Sturtivant wrote: What is the design logic behind 364.d(9): Error: alias this compileme364.number.__anonymous there can be only one alias this --- not a complaint, I'd just like to hear opinion of the basis of the above restriction from experts. This is a limitation

Re: CTFE question

2012-09-03 Thread Don Clugston
On 28/08/12 19:40, Philippe Sigaud wrote: On Tue, Aug 28, 2012 at 2:07 PM, Chris Cain clc...@uncg.edu wrote: On Tuesday, 28 August 2012 at 11:39:20 UTC, Danny Arends wrote: Ahhh I understand... As a follow up, is it then possible to 'track' filling a large enum / immutable on compile time by

Re: Function pointers/delegates default args were stealth removed?

2012-08-28 Thread Don Clugston
On 27/08/12 16:16, Steven Schveighoffer wrote: On Sun, 26 Aug 2012 18:26:40 -0400, Manu turkey...@gmail.com wrote: I just updated to 2.60 and found errors throughout my code where function pointers default args no longer work. *Every single project* I've written in D, 5 projects, don't work

Re: More on vectorized comparisons

2012-08-27 Thread Don Clugston
On 24/08/12 15:57, bearophile wrote: It's just syntax sugar for a very obscure operation, It's an operation included in Cilk Plus, I think Intel devs know enough what they are doing. And I think code like this is a common need: if (a[] 0) { // ... } and it's somewhat ambiguous -- is

Re: More on vectorized comparisons

2012-08-24 Thread Don Clugston
On 24/08/12 00:13, bearophile wrote: Sean Cavanaugh: Well, right now the binary operators == != = = and are required to return bool instead of allowing a user defined type, which prevents a lot of the sugar you would want to make the code nice to write. The hypothetical D sugar I was

Re: Ascii matters

2012-08-23 Thread Don Clugston
On 23/08/12 05:05, bearophile wrote: Sean Kelly: I'm clearly missing something. ASCII and UTF-8 are compatible. What's stopping you from just processing these as if they were UTF-8 strings? std.algorithm is not closed (http://en.wikipedia.org/wiki/Closure_%28mathematics%29 ) on UTF-8, its

Re: NaNs Just Don't Get No Respect

2012-08-21 Thread Don Clugston
On 20/08/12 22:21, cal wrote: On Monday, 20 August 2012 at 19:28:33 UTC, Peter Alexander wrote: On Sunday, 19 August 2012 at 22:22:28 UTC, Walter Bright wrote: I find it more likely that the NaN will go unnoticed and cause rare bugs. NaNs in your output are pretty obvious. For example, if

Re: NaNs Just Don't Get No Respect

2012-08-20 Thread Don Clugston
On 18/08/12 05:03, bearophile wrote: F i L: Why would it matter what is normal? It matters to me because I am curious. Why aren't my friends that work or study chemistry writing free small online articles like my programmerCS friends do? Maybe it's systematic differences in their brain

Re: DMD diagnostic - any way to remove identical lines from final dmd error log?

2012-08-14 Thread Don Clugston
On 13/08/12 18:47, Dmitry Olshansky wrote: I seriously consider writing a simple postprocessor for dmd's output. Once dmd became able to recover from errors and crawl on it started to produce horrific amounts of redundant text on failure. Observe for instance that there are only 6 + 2 = 8 lines

Re: Which D features to emphasize for academic review article

2012-08-14 Thread Don Clugston
On 14/08/12 05:03, TJB wrote: On Monday, 13 August 2012 at 10:11:06 UTC, Don Clugston wrote: ... I have come to believe that there are very few algorithms originally designed for integers, which also work correctly for floating point. Integer code nearly always assumes things like, x + 1

Re: DMD diagnostic - any way to remove identical lines from final dmd error log?

2012-08-14 Thread Don Clugston
On 14/08/12 08:59, Don Clugston wrote: On 13/08/12 18:47, Dmitry Olshansky wrote: I seriously consider writing a simple postprocessor for dmd's output. Once dmd became able to recover from errors and crawl on it started to produce horrific amounts of redundant text on failure. Observe

Re: DMD diagnostic - any way to remove identical lines from final dmd error log?

2012-08-14 Thread Don Clugston
On 14/08/12 11:32, Paulo Pinto wrote: On Tuesday, 14 August 2012 at 08:48:14 UTC, Don Clugston wrote: On 14/08/12 08:59, Don Clugston wrote: On 13/08/12 18:47, Dmitry Olshansky wrote: I seriously consider writing a simple postprocessor for dmd's output. Once dmd became able to recover from

Re: Which D features to emphasize for academic review article

2012-08-14 Thread Don Clugston
On 14/08/12 12:31, Mehrdad wrote: On Saturday, 11 August 2012 at 05:41:23 UTC, Walter Bright wrote: On 8/10/2012 9:55 PM, F i L wrote: On the first condition, without an 'else z = ...', or if the condition was removed at a later time, then you'll get a compiler error and be forced to

Re: Which D features to emphasize for academic review article

2012-08-13 Thread Don Clugston
On 12/08/12 01:31, Walter Bright wrote: On 8/11/2012 3:01 PM, F i L wrote: Walter Bright wrote: I'd rather have a 100 easy to find bugs than 1 unnoticed one that went out in the field. That's just the thing, bugs are arguably easier to hunt down when things default to a consistent, usable

Re: Incomprehensible compiler errors

2012-07-31 Thread Don Clugston
On 31/07/12 00:54, Stuart wrote: On Monday, 30 July 2012 at 21:40:35 UTC, Walter Bright wrote: A ModuleInfo is generated for each compiled module and inserted into its corresponding .obj file. If the linker cannot find it, then it is likely that you need to specify that .obj on the link

  1   2   3   >