Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 10:31 PM, Sergey Korshunoff via Digitalmars-d wrote: 2015-11-11 15:19 GMT+03:00, Walter Bright via Digitalmars-d I've looked into generating C code as an output format. I found the problems to be endemic and working around them was harder than just generating native code: 1. You'r

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Sergey Korshunoff via Digitalmars-d
2015-11-11 15:19 GMT+03:00, Walter Bright via Digitalmars-d > I've looked into generating C code as an output format. I found the problems > to > be endemic and working around them was harder than just generating native > code: > > 1. You're at the mercy of bugs in the C compiler you cannot fix. >

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 1:35 PM, Ola Fosheim Grøstad wrote: In C the OS/hardware vendors define the binary interface and provides the tooling... So what is your point? Plenty if useful tools and languages compiles to C successfully. That's a undeniable fact. That's reality. True, but that doesn't suppor

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread deadalnix via Digitalmars-d
On Friday, 13 November 2015 at 21:54:25 UTC, Araq wrote: On Wednesday, 11 November 2015 at 18:25:59 UTC, deadalnix wrote: Nim does everything according to their marketing department. The engineering department remains to be found. Pretty sure you know where you can find me and discuss these t

Re: opDispatch and compile time parameters

2015-11-13 Thread Jakob Ovrum via Digitalmars-d
On Saturday, 14 November 2015 at 04:10:59 UTC, Steven Schveighoffer wrote: Is it me, or is this a bug? struct Foo { template opDispatch(string s) { // if you uncomment this, it compiles //void opDispatch() {} void opDispatch(T...)() {} } } void main() { Foo f; f.bl

Re: opDispatch and compile time parameters

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d
On 10/18/15 9:00 PM, David Osborne wrote: On Saturday, 17 October 2015 at 15:31:00 UTC, Nikolay wrote: I asked on SO question about opDispatch and compile time parameters: http://stackoverflow.com/questions/32998781/opdispatch-and-compile-time-parameters [...] Is it good idea for opDispatch imp

Re: Persistent list

2015-11-13 Thread Jonathan M Davis via Digitalmars-d
On Friday, 13 November 2015 at 23:10:04 UTC, Andrei Alexandrescu wrote: * Lines 26-29: The allocator is fundamentally a mutable part of the container. This is an insufficiency of our type system - we can't say "this object may be constant, but this reference is to a mutable part of it". We can'

Re: DMD is faster than LDC and GDC

2015-11-13 Thread cym13 via Digitalmars-d
On Friday, 13 November 2015 at 19:59:51 UTC, Ali Çehreli wrote: On 11/12/2015 11:50 AM, Ali Çehreli wrote: I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable

Re: Here's looking at you, kid

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 4:37 PM, bachmeier wrote: I've proposed this before but it didn't get much attention, so let me bring it up again. In a lot of cases there are already good explanations in Ali's book or on the wiki, but new users won't know about them. We could greatly improve the quality of the do

Re: Here's looking at you, kid

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 4:47 PM, Manu via Digitalmars-d wrote: Count me among them. I've been trying to do a lot of C++ interop recently; referred to that page which didn't help, and then continued mainly by trial and error. I would really like to know the current state for my work, I just try stuff and ho

Re: Our template emission strategy is broken

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 9:23 AM, Johannes Pfau wrote: Ellery filed a bug report and I've posted a reduced test case: https://issues.dlang.org/show_bug.cgi?id=15324 Thank you!

Re: Persistent list

2015-11-13 Thread Rikki Cattermole via Digitalmars-d
Hmm. We can't have immutability and ref counting. Lets just say, the only time ref counting should come into effect is IF it has been removed from the list. This way the list should consider it 'owned' by it. This is where I say, immutability by itself isn't the problem. The problem is we are

Re: Deprecating Allocating Functions In std.string

2015-11-13 Thread Jonathan M Davis via Digitalmars-d
On Friday, 13 November 2015 at 21:48:58 UTC, Rory McGuire wrote: On Thu, Nov 5, 2015 at 2:02 AM, Jonathan M Davis via Digitalmars-d < digitalmars-d@puremagic.com> wrote: We've been adding lazy versions of functions for years now, and we've never removed the eager versions. And I'm pretty su

Re: Our template emission strategy is broken

2015-11-13 Thread Daniel Murphy via Digitalmars-d
On 13/11/2015 8:26 PM, Robert burner Schadek wrote: On Friday, 13 November 2015 at 02:50:07 UTC, Daniel Murphy wrote: You also need to modify root/rmem.d to actually use the GC as the allocator. I should have known that it couldn't be that simple. Anyway, after doing so. Building druntime and

Re: Anyone working on updated Qt bindings?

2015-11-13 Thread Ramon via Digitalmars-d
On Friday, 13 November 2015 at 21:30:34 UTC, karabuta wrote: On Friday, 13 November 2015 at 20:03:38 UTC, Ramon wrote: Just for note, you can make desktop D applications in HTML/CSS3/scripting using https://github.com/midiway/sciter-dport May be Github's Electron or D's webview bindings(whic

Re: Here's looking at you, kid

2015-11-13 Thread Manu via Digitalmars-d
On 14 November 2015 at 09:24, tsbockman via Digitalmars-d wrote: > On Friday, 13 November 2015 at 22:34:18 UTC, Andrei Alexandrescu wrote: >> >> Hi everyone, >> >> >> Recently there's been an uptick of site visits on dlang.org and also dmd >> downloads (http://erdani.com/d/downloads.daily.png). >>

Re: Here's looking at you, kid

2015-11-13 Thread bachmeier via Digitalmars-d
On Friday, 13 November 2015 at 22:34:18 UTC, Andrei Alexandrescu wrote: Hi everyone, Recently there's been an uptick of site visits on dlang.org and also dmd downloads (http://erdani.com/d/downloads.daily.png). Amid increased scrutiny it's important to focus on improving documentation. I su

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Manu via Digitalmars-d
On 13 November 2015 at 08:38, Iain Buclaw via Digitalmars-d wrote: > On 12 Nov 2015 10:25 pm, "David Nadlinger via Digitalmars-d" > wrote: >> >> On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: >>> >>> It's more than that - dmd's optimizer is designed to make use of the >>> gua

Re: Here's looking at you, kid

2015-11-13 Thread bitwise via Digitalmars-d
On Friday, 13 November 2015 at 23:44:51 UTC, Steven Schveighoffer wrote: ++("I definitely think it's something that should be updated.");

Re: Persistent list

2015-11-13 Thread Jakob Ovrum via Digitalmars-d
On Friday, 13 November 2015 at 23:10:04 UTC, Andrei Alexandrescu wrote: * Lines 11-12: I came to terms with the notion that some types cannot be made immutable. We've been trying to do reference counting on immutable objects for a long time. It's time to acknowledge that true immutability (whic

Re: Here's looking at you, kid

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d
On 11/13/15 6:24 PM, tsbockman wrote: On Friday, 13 November 2015 at 22:34:18 UTC, Andrei Alexandrescu wrote: Hi everyone, Recently there's been an uptick of site visits on dlang.org and also dmd downloads (http://erdani.com/d/downloads.daily.png). Amid increased scrutiny it's important to fo

Re: Persistent list

2015-11-13 Thread Timon Gehr via Digitalmars-d
On 11/14/2015 12:10 AM, Andrei Alexandrescu wrote: * Lines 6: By construction the list doesn't work with mutable objects. =(

Re: Persistent list

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d
On 11/13/15 6:10 PM, Andrei Alexandrescu wrote: I created a simple persistent list with reference counting and custom allocation at http://dpaste.dzfl.pl/0981640c2835. It's a good illustration of a number of issues. In particular, each cast must be properly explained. Here's my exegesis: * L

Re: Persistent list

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/13/2015 03:10 PM, Andrei Alexandrescu wrote: > at http://dpaste.dzfl.pl/0981640c2835 > * Lines 11-12: I came to terms with the notion that some types cannot be > made immutable. Could constructor qualifiers help in such cases? I would like to hear war stories and experiences from others

Re: Here's looking at you, kid

2015-11-13 Thread tsbockman via Digitalmars-d
On Friday, 13 November 2015 at 22:34:18 UTC, Andrei Alexandrescu wrote: Hi everyone, Recently there's been an uptick of site visits on dlang.org and also dmd downloads (http://erdani.com/d/downloads.daily.png). Amid increased scrutiny it's important to focus on improving documentation. I su

Persistent list

2015-11-13 Thread Andrei Alexandrescu via Digitalmars-d
I created a simple persistent list with reference counting and custom allocation at http://dpaste.dzfl.pl/0981640c2835. It's a good illustration of a number of issues. In particular, each cast must be properly explained. Here's my exegesis: * Lines 6: By construction the list doesn't work wit

Re: Here's looking at you, kid

2015-11-13 Thread Brian Schott via Digitalmars-d
On Friday, 13 November 2015 at 22:34:18 UTC, Andrei Alexandrescu wrote: Hi everyone, Recently there's been an uptick of site visits on dlang.org and also dmd downloads (http://erdani.com/d/downloads.daily.png). Amid increased scrutiny it's important to focus on improving documentation. I su

Here's looking at you, kid

2015-11-13 Thread Andrei Alexandrescu via Digitalmars-d
Hi everyone, Recently there's been an uptick of site visits on dlang.org and also dmd downloads (http://erdani.com/d/downloads.daily.png). Amid increased scrutiny it's important to focus on improving documentation. I suggest everyone in the community to consider improving dlang.org in any w

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Araq via Digitalmars-d
On Wednesday, 11 November 2015 at 18:25:59 UTC, deadalnix wrote: Nim does everything according to their marketing department. The engineering department remains to be found. Pretty sure you know where you can find me and discuss these things with me. Not sure if I count as a software engineer

Re: Deprecating Allocating Functions In std.string

2015-11-13 Thread Rory McGuire via Digitalmars-d
On Thu, Nov 5, 2015 at 2:02 AM, Jonathan M Davis via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > > We've been adding lazy versions of functions for years now, and we've > never removed the eager versions. And I'm pretty sure that Walter and > Andrei have generally been opposed to the ide

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
In C the OS/hardware vendors define the binary interface and provides the tooling... So what is your point? Plenty if useful tools and languages compiles to C successfully. That's a undeniable fact. That's reality.

Re: Anyone working on updated Qt bindings?

2015-11-13 Thread karabuta via Digitalmars-d
On Friday, 13 November 2015 at 20:03:38 UTC, Ramon wrote: Just for note, you can make desktop D applications in HTML/CSS3/scripting using https://github.com/midiway/sciter-dport May be Github's Electron or D's webview bindings(which also abstracts too much, with too much weird naming convent

Re: Rust's simple download script

2015-11-13 Thread Rory McGuire via Digitalmars-d
On Tue, Nov 10, 2015 at 6:56 PM, Steven Schveighoffer via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > > I've been using dvm, and do like it a lot. But I couple issues: > > 1. Every time I type dvm use, my path adds another directory. Couldn't you > just replace the existing dvm path? > 2

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread deadalnix via Digitalmars-d
On Friday, 13 November 2015 at 20:51:54 UTC, Ola Fosheim Grøstad wrote: On Friday, 13 November 2015 at 14:31:08 UTC, Chris wrote: So D does a better job at interfacing to C/C++, because it uses the same memory model as C/C++, as opposed to outputting C code like Nim. This is actually very cleve

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 13 November 2015 at 14:31:08 UTC, Chris wrote: So D does a better job at interfacing to C/C++, because it uses the same memory model as C/C++, as opposed to outputting C code like Nim. This is actually very clever. err... No. You get better interop by transpiling to C/C++. With C i

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Vladimir Panteleev via Digitalmars-d
On Thursday, 12 November 2015 at 21:24:30 UTC, David Nadlinger wrote: On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: [...] Oh, GCC has had similar notions as a non-standard attribute for ages, and LLVM since its inception. At least for LDC, the reason why we do not curr

Re: Anyone working on updated Qt bindings?

2015-11-13 Thread Ramon via Digitalmars-d
Just for note, you can make desktop D applications in HTML/CSS3/scripting using https://github.com/midiway/sciter-dport

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/12/2015 11:50 AM, Ali Çehreli wrote: I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable(table); > } I think what we are seeing here is more due to

Re: Blocker for the container work

2015-11-13 Thread Andrei Alexandrescu via Digitalmars-d
On 11/13/2015 12:25 PM, rsw0x wrote: On Friday, 13 November 2015 at 17:01:34 UTC, Andrei Alexandrescu wrote: I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 which is currently blocking my work on containers. In brief the postblit isn't called upon calling Range save() { return

Re: Catching C++ std::exception in D

2015-11-13 Thread Iain Buclaw via Digitalmars-d
On 13 November 2015 at 18:45, Dan Olson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > Johannes Pfau writes: > > > Am Thu, 12 Nov 2015 09:59:14 -0800 > > schrieb Dan Olson : > > > >> Johannes Pfau writes: > >> > To expand on this: I think we'd prefer one __d_personality_v0 which > >>

Re: Anyone working on updated Qt bindings?

2015-11-13 Thread MGW via Digitalmars-d
This is primer program on QtE import std.stdio;// writeln import core.runtime; // Processing of input parameters import std.net.curl: get; import qte; // work with Qt class Exam: QMainWindow { this() {

Re: Catching C++ std::exception in D

2015-11-13 Thread Dan Olson via Digitalmars-d
Johannes Pfau writes: > Am Thu, 12 Nov 2015 09:59:14 -0800 > schrieb Dan Olson : > >> Johannes Pfau writes: >> > To expand on this: I think we'd prefer one __d_personality_v0 which >> > is implemented in upstream druntime and identical for all >> > compilers. >> >> Speacking of upstream suppo

Re: Blocker for the container work

2015-11-13 Thread Jonathan M Davis via Digitalmars-d
On Friday, 13 November 2015 at 17:25:44 UTC, rsw0x wrote: afaik that's RVO, isn't it? D's RVO semantics are pretty much unspecified still(outside of dmd,) I believe(don't quote me) that walter said it's supposed to be part of the spec but I could never find anything. Well, RVO is used when th

Re: Blocker for the container work

2015-11-13 Thread rsw0x via Digitalmars-d
On Friday, 13 November 2015 at 17:01:34 UTC, Andrei Alexandrescu wrote: I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 which is currently blocking my work on containers. In brief the postblit isn't called upon calling Range save() { return this; } which of course is less than

Re: Our template emission strategy is broken

2015-11-13 Thread Johannes Pfau via Digitalmars-d
Am Thu, 12 Nov 2015 15:15:24 -0800 schrieb Walter Bright : > On 11/11/2015 5:47 AM, Johannes Pfau wrote: > > Ellery Newcomer recently reported a template emission bug where > > templates are emitted twice: > > http://forum.dlang.org/thread/n1omke$1bh5$1...@digitalmars.com > > Please file bug re

Blocker for the container work

2015-11-13 Thread Andrei Alexandrescu via Digitalmars-d
I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 which is currently blocking my work on containers. In brief the postblit isn't called upon calling Range save() { return this; } which of course is less than helpful. Reductions of the example would be awesome - I reduced it a fa

Re: wiki 'send confirmation e-mail is broken'

2015-11-13 Thread Ramon via Digitalmars-d
On Friday, 13 November 2015 at 00:26:04 UTC, Vladimir Panteleev wrote: On Thursday, 12 November 2015 at 23:04:11 UTC, Ramon wrote: I registered in the wiki http://wiki.dlang.org/The_D_Programming_Language, but I never receive the confirmation e-mail, so I can't contribute.. maybe someone can

Re: Improving coverage

2015-11-13 Thread Jonathan M Davis via Digitalmars-d
On Friday, 13 November 2015 at 13:30:13 UTC, Andrei Alexandrescu wrote: Any takers for https://issues.dlang.org/show_bug.cgi?id=15327? -- Andrei Fixing it so that assert(0) doesn't count against the code coverage would be fantastic. Without enhancements like it, requiring 100% code coverage o

Re: RFC in Comparison between Rust, D and Go

2015-11-13 Thread Chris via Digitalmars-d
On Wednesday, 11 November 2015 at 12:19:40 UTC, Walter Bright wrote: On 11/9/2015 3:26 PM, deadalnix wrote: I've looked into generating C code as an output format. I found the problems to be endemic and working around them was harder than just generating native code: 1. You're at the mercy o

Re: Our template emission strategy is broken

2015-11-13 Thread Atila Neves via Digitalmars-d
On Wednesday, 11 November 2015 at 13:08:08 UTC, David Nadlinger wrote: Hi all, Kenji and Walter have been working on improving the template emission strategy during the last couple of releases, i.e. whether a template instance is emitted to a given object file or not. Nevertheless, I've been

Re: Our template emission strategy is broken

2015-11-13 Thread Atila Neves via Digitalmars-d
On Wednesday, 11 November 2015 at 13:56:51 UTC, Martin Nowak wrote: On Wednesday, 11 November 2015 at 13:47:27 UTC, Johannes Pfau wrote: I think we should really fix these issues, working separate compilation is very important. No, it's not. Separate compilation is C++-ishly slow by design (b

Improving coverage

2015-11-13 Thread Andrei Alexandrescu via Digitalmars-d
Any takers for https://issues.dlang.org/show_bug.cgi?id=15327? -- Andrei

Re: std.stdio.writeln should not accept infinite ranges?

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d
On 11/12/15 10:21 PM, Xinok wrote: On Friday, 13 November 2015 at 01:19:22 UTC, Andrei Alexandrescu wrote: On 11/12/2015 08:18 PM, Xinok wrote: The following code compiles and runs: import std.stdio, std.random; void main() { writeln(rndGen); } Since rndGen is an infinite range, this co

Re: wiki 'send confirmation e-mail is broken'

2015-11-13 Thread Steven Schveighoffer via Digitalmars-d
On 11/12/15 6:04 PM, Ramon wrote: I registered in the wiki http://wiki.dlang.org/The_D_Programming_Language, but I never receive the confirmation e-mail, so I can't contribute.. maybe someone can manually activate my account: midiway Vladimir has an explanation, but one thing I do remember a l

Re: Our template emission strategy is broken

2015-11-13 Thread Stefan via Digitalmars-d
On Thursday, 12 November 2015 at 23:08:57 UTC, Jakob Ovrum wrote: > [...dependency check...] It can be implemented as an external tool with the -deps compiler switch. there is depend [1]. It warns about cycles and unintended dependencies if you specify the target dependencies. It helps us

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread John Colvin via Digitalmars-d
On Friday, 13 November 2015 at 12:06:43 UTC, Matthias Bentrup wrote: On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote: unsigned: f(v) = v mod 2^n - 1 signed: f(v) = ((v + 2^(n-1)) mod (2^n - 1)) - 2^(n-1) I guess you meant mod 2^n in both cases... haha, yes, sorry.

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Matthias Bentrup via Digitalmars-d
On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote: unsigned: f(v) = v mod 2^n - 1 signed: f(v) = ((v + 2^(n-1)) mod (2^n - 1)) - 2^(n-1) I guess you meant mod 2^n in both cases... If you look at how Mathematics deals with this issue, there is simply no signed or unsigned arithmet

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread John Colvin via Digitalmars-d
On Friday, 13 November 2015 at 10:20:53 UTC, Don wrote: On Friday, 13 November 2015 at 09:37:41 UTC, deadalnix wrote: On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote: I don't understand what you think is so complicated about it? After arithmetic operations f is applied signed:

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Kagamin via Digitalmars-d
On Friday, 13 November 2015 at 09:37:41 UTC, deadalnix wrote: It is not that it is complicated, but that signed wraparound is almost always a bug. In C/C++, that result in very questionable optimizations. But defining the thing as wraparound is also preventing it to become an error. What abou

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread David Nadlinger via Digitalmars-d
On Friday, 13 November 2015 at 06:00:08 UTC, Walter Bright wrote: It's worth checking how LDC and GDC deal with this deep in their optimizer - is it considering it undefined behavior? Signed types will wrap around correctly for LDC. — David

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 13 November 2015 at 10:20:53 UTC, Don wrote: Oh, I like that! That does seem to be the best of both worlds. Then, as a QOI issue, the compiler can try to detect the error. If it does not detect the error, it MUST provide the two's complement result. It is not allowed to do any weird

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 13 November 2015 at 09:09:33 UTC, Don wrote: (Note that unlike the unsigned case, there is no simple explanation of what happens). Well, negative overflow for unsigned probably should be illegal too. Ada got this right by having: 32 bit signed integers monotonic 31 bit unsigned in

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Don via Digitalmars-d
On Friday, 13 November 2015 at 09:37:41 UTC, deadalnix wrote: On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote: I don't understand what you think is so complicated about it? After arithmetic operations f is applied signed: f(v) = ((v + 2^(n-1)) mod (2^n - 1)) - 2^(n-1) Complic

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 1:10 AM, Iain Buclaw via Digitalmars-d wrote: We are not. For gdc, the fwrapv flag is enabled by default. Good!

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Walter Bright via Digitalmars-d
On 11/13/2015 1:09 AM, Don wrote: Please let's be precise about this. I'd be happy if you contributed the precise wording we need!

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread deadalnix via Digitalmars-d
On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote: I don't understand what you think is so complicated about it? It is not that it is complicated, but that signed wraparound is almost always a bug. In C/C++, that result in very questionable optimizations. But defining the thing

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread John Colvin via Digitalmars-d
On Friday, 13 November 2015 at 09:09:33 UTC, Don wrote: At the very least, we should change the terminology on that page. The word "overflow" should not be used when referring to both signed and unsigned types. On that page, it is describing two very different phenomena, and gives the impressio

Re: Our template emission strategy is broken

2015-11-13 Thread Robert burner Schadek via Digitalmars-d
On Friday, 13 November 2015 at 02:50:07 UTC, Daniel Murphy wrote: You also need to modify root/rmem.d to actually use the GC as the allocator. I should have known that it couldn't be that simple. Anyway, after doing so. Building druntime and phobos die with a segfault, but all dmd tests pass,

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Kagamin via Digitalmars-d
On Friday, 13 November 2015 at 09:09:33 UTC, Don wrote: Suppose we made it an error. We'd be in a much better position than C. We could easily add a check for integer overflow into CTFE. We could allow compilers and static analysis tools to implement runtime checks for integer overflow, as well

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 13 November 2015 at 08:51:27 UTC, Ali Çehreli wrote: I understood Walter's response to be so. That's my interpretation of what Walter has said before too. So a D compiler cannot prevent compilation of a statically detected wrapping (overflow). As a result D-integers are circular e

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Iain Buclaw via Digitalmars-d
On 13 Nov 2015 7:05 am, "Walter Bright via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On 11/12/2015 4:43 PM, Ali Çehreli wrote: >> >> So the question is, do we support twos complement only, hence signed overflow is >> defined as wrap, > > > Yes. I see no reason to support 1's compleme

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Don via Digitalmars-d
On Friday, 13 November 2015 at 05:47:03 UTC, deadalnix wrote: Signed overflow are defined as well, as wraparound. Can we please, please, please not have that as official policy without carefully thinking through the implications? It is undefined behaviour in C and C++, so we are not constrai

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/13/2015 12:30 AM, Ola Fosheim Grøstad wrote: > On Friday, 13 November 2015 at 06:46:37 UTC, Ali Çehreli wrote: >> Since it's UB in C and C++, I've heard that both clang and gcc do >> remove code branches if they can prove that there will be signed >> overflow. I don't know how or whether tha

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Friday, 13 November 2015 at 06:46:37 UTC, Ali Çehreli wrote: Since it's UB in C and C++, I've heard that both clang and gcc do remove code branches if they can prove that there will be signed overflow. I don't know how or whether that optimization is turned off for D. The question you want

Re: Our template emission strategy is broken

2015-11-13 Thread Dicebot via Digitalmars-d
I know what the problem is. Hence you need to import a in b and b in a. There is not really anyway around this because this is intrinsically how mixin works. It could be all much easier if resolving aliases was controllable in generic code, most importantly in regards of .stringof

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread deadalnix via Digitalmars-d
On Friday, 13 November 2015 at 06:46:37 UTC, Ali Çehreli wrote: Since it's UB in C and C++, I've heard that both clang and gcc do remove code branches if they can prove that there will be signed overflow. I don't know how or whether that optimization is turned off for D. Ali Clang does it,