Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread NoMoreBugs via Digitalmars-d-announce
On Monday, 12 November 2018 at 21:38:27 UTC, Walter Bright wrote: On 11/12/2018 8:28 AM, 12345swordy wrote: The issue that I see is unintended implicit conversation when passing values to functions that have both int and bool overloads. The exact same thing happens when there are both int

Re: NES emulator written in D

2018-11-12 Thread blahness via Digitalmars-d-announce
On Tuesday, 13 November 2018 at 05:59:52 UTC, Manu wrote: Nice work. Oh wow, this is pretty rough! ``` void createTable() { this.table = [ , , , , , , , , , , , , , , , , ... ``` Here's one I prepared earlier: https://github.com/TurkeyMan/superemu (probably doesn't work with

Re: NES emulator written in D

2018-11-12 Thread Manu via Digitalmars-d-announce
On Sat, Feb 3, 2018 at 5:55 AM blahness via Digitalmars-d-announce wrote: > > Hi everyone, > > Not sure how interested people here will be with this but I've > ported https://github.com/fogleman/nes from Go to D [1]. I should > point out that I'm not the author of the original Go version. > > The

Re: NES emulator written in D

2018-11-12 Thread blahness via Digitalmars-d-announce
On Saturday, 3 February 2018 at 13:52:17 UTC, blahness wrote: Hi everyone, Not sure how interested people here will be with this but I've ported https://github.com/fogleman/nes from Go to D [1]. I should point out that I'm not the author of the original Go version. The emulator code itself

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread H. S. Teoh via Digitalmars-d-announce
On Tue, Nov 13, 2018 at 02:12:30AM +, 12345swordy via Digitalmars-d-announce wrote: > On Monday, 12 November 2018 at 21:38:27 UTC, Walter Bright wrote: [...] > > The underlying issue is is bool a one bit integer type, or something > > special? D defines it as a one bit integer type, fitting

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread 12345swordy via Digitalmars-d-announce
On Monday, 12 November 2018 at 21:38:27 UTC, Walter Bright wrote: On 11/12/2018 8:28 AM, 12345swordy wrote: The issue that I see is unintended implicit conversation when passing values to functions that have both int and bool overloads. The exact same thing happens when there are both int

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Tue, 13 Nov 2018 00:28:46 +, Isaac S. wrote: > Sorry if it wasn't clear, I meant that if `enum Foo : some_int_type` > makes it so some_int_type is preferred (because it's a more direct > conversion) DScanner could warn anyone that just does `enum Foo`. Sorry, I read too hastily and thought

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Isaac S. via Digitalmars-d-announce
On Tuesday, 13 November 2018 at 00:21:25 UTC, Neia Neutuladh wrote: On Tue, 13 Nov 2018 00:08:04 +, Isaac S. wrote: If you really want this plaque in the language, at least make it not affect those that gave their enum a type. If you at least do that, someone can add it to DScanner to tell

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Tue, 13 Nov 2018 00:08:04 +, Isaac S. wrote: > If you really want this plaque in the language, at least make it not > affect those that gave their enum a type. If you at least do that, > someone can add it to DScanner to tell anyone that doesn't type their > enum to expect illogical

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Mon, 12 Nov 2018 14:07:39 -0800, Walter Bright wrote: > => conversion> >=> conversion> One confusion is from value range propagation / constant folding reaching past the static type information to yield a different result from what static typing alone

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Isaac S. via Digitalmars-d-announce
On Monday, 12 November 2018 at 22:07:39 UTC, Walter Bright wrote: *snip* Both f(int) and f(short) match, because implicit conversions rank the same. To disambiguate, f(short) is pitted against f(int) using partial ordering rules, which are: Can a short be used to call f(int)? Yes. Can

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Isaac S. via Digitalmars-d-announce
On Monday, 12 November 2018 at 21:29:20 UTC, Walter Bright wrote: *snip* In my college daze I was learning programming alongside designing and building digital circuits, and later software for FPGAs and PLDs (ABEL). The notions of True, T, 1, !0 (from C and Asm), and +5V are all completely

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Walter Bright via Digitalmars-d-announce
On 11/12/2018 1:39 PM, 12345swordy wrote: OK, I got to know what language you were using at the time, because I am curious at what other oddities does it have. I wish I could remember what it was. It was like 40 years ago :-)

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Walter Bright via Digitalmars-d-announce
On 11/12/2018 12:34 PM, Neia Neutuladh wrote: Tell me more about this "consistency". int f(short s) { return 1; } int f(int i) { return 2; } enum : int { a = 0 } enum A : int { a = 0 } pragma (msg, f(a)); // calls f(int) pragma (msg, f(A.a)); // calls f(short) I.e. it's consistent.

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Walter Bright via Digitalmars-d-announce
On 11/12/2018 11:28 AM, Adam D. Ruppe wrote: D used to have a `bit` type, wy back in the day. It was renamed to `bool` way back in D 0.148, released Feb 25, 2006. D's old bit type was not a bool. It literally was a single bit, and an array of bits was packed into an int by the compiler.

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Walter Bright via Digitalmars-d-announce
On 11/12/2018 8:28 AM, 12345swordy wrote: The issue that I see is unintended implicit conversation when passing values to functions that have both int and bool overloads. The exact same thing happens when there are both int and short overloads. The underlying issue is is bool a one bit

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread 12345swordy via Digitalmars-d-announce
On Monday, 12 November 2018 at 21:29:20 UTC, Walter Bright wrote: I once worked with software that defined true as 0 and false as 1 OK, I got to know what language you were using at the time, because I am curious at what other oddities does it have. -Alex

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Walter Bright via Digitalmars-d-announce
On 11/12/2018 2:05 AM, Jonathan M Davis wrote: *sigh* Well, I guess that's the core issue right there. A lot of us would strongly disagree with the idea that bool is an integral type and consider code that treats it as such as inviting bugs. In my college daze I was learning programming

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Mon, 12 Nov 2018 20:34:11 +, Neia Neutuladh wrote: > enum : int { a = 0 } > enum A : int { a = 0 } > f(a); // calls the int overload f(A.a); // calls the bool overload > > Tell me more about this "consistency". Filed issue 19394. (Sorry for spam.)

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Mon, 12 Nov 2018 09:45:14 +, Mike Parker wrote: > From Example B in the DIP: > > ``` > int f(bool b) { return 1; } > int f(int i) { return 2; } > > enum E : int { > a = 0, > b = 1, > c = 2, > } > ``` > > Here, f(a) and f(b) call the bool overload, while f(c) calls the int

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Neia Neutuladh via Digitalmars-d-announce
On Mon, 12 Nov 2018 14:10:42 -0500, Steven Schveighoffer wrote: > But it's not consistent: And std.traits.isIntegral has not considered bools integral since its initial creation in 2007. Both Walter and Andrei have mucked about with that code and saw no reason to change it, even in wild and

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Adam D. Ruppe via Digitalmars-d-announce
On Monday, 12 November 2018 at 18:25:22 UTC, Bastiaan Veelo wrote: I can’t say I have a strong opinion on this, but possibly it would be right to have an integral “bit” type to differentiate it from the Boolean type, just like we have a “byte” type to differentiate it from “char”... D used

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Steven Schveighoffer via Digitalmars-d-announce
On 11/12/18 4:45 AM, Mike Parker wrote: DIP 1015, "Deprecation and removal of implicit conversion from integer and character literals to bool, has been rejected, primarily on the grounds that it is factually incorrect in treating bool as a type distinct from other integral types. The TL;DR

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 12 November 2018 at 17:49:55 UTC, Joakim wrote: […] it's quite simple: they view a bool as an integral type with two possible values, a `bit` if you like. As such, they prefer to fit it into the existing scheme for integral types rather than special-casing booleans as Mike proposed.

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Joakim via Digitalmars-d-announce
On Monday, 12 November 2018 at 17:25:15 UTC, Johannes Loher wrote: On Monday, 12 November 2018 at 16:39:47 UTC, Mike Parker wrote: Walter and Andrei take the position that this is incorrect the wrong way to view a bool. Unfortunately you did not include their justification for this position

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Mike Parker via Digitalmars-d-announce
On Monday, 12 November 2018 at 17:25:15 UTC, Johannes Loher wrote: On Monday, 12 November 2018 at 16:39:47 UTC, Mike Parker wrote: Walter and Andrei take the position that this is incorrect the wrong way to view a bool. Unfortunately you did not include their justification for this position

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Johannes Loher via Digitalmars-d-announce
On Monday, 12 November 2018 at 16:39:47 UTC, Mike Parker wrote: Walter and Andrei take the position that this is incorrect the wrong way to view a bool. Unfortunately you did not include their justification for this position (if any). To me it would be interesting to know about the reasoning

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Mike Parker via Digitalmars-d-announce
On Monday, 12 November 2018 at 15:15:17 UTC, M.M. wrote: On Monday, 12 November 2018 at 15:03:08 UTC, Adam D. Ruppe wrote: On Monday, 12 November 2018 at 09:45:14 UTC, Mike Parker wrote: The TL;DR is that the DIP is trying to change behavior that is working as intended. I thought the whole

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread 12345swordy via Digitalmars-d-announce
On Monday, 12 November 2018 at 10:05:09 UTC, Jonathan M Davis wrote: On Monday, November 12, 2018 2:45:14 AM MST Mike Parker via Digitalmars-d- announce wrote: DIP 1015, "Deprecation and removal of implicit conversion from integer and character literals to bool, has been rejected, primarily on

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread M.M. via Digitalmars-d-announce
On Monday, 12 November 2018 at 15:03:08 UTC, Adam D. Ruppe wrote: On Monday, 12 November 2018 at 09:45:14 UTC, Mike Parker wrote: The TL;DR is that the DIP is trying to change behavior that is working as intended. I thought the whole point of a DIP is to change behavior that is working as

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Adam D. Ruppe via Digitalmars-d-announce
On Monday, 12 November 2018 at 09:45:14 UTC, Mike Parker wrote: The TL;DR is that the DIP is trying to change behavior that is working as intended. I thought the whole point of a DIP is to change behavior that is working as intended. Otherwise, we have a bug fix rather than a language

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Kagamin via Digitalmars-d-announce
That's strange, I thought polysemous literals prefer default type, not tightest type. --- auto b=1; static assert(is(typeof(b)==bool)); --- Error: static assert: is(int == bool) is false

Re: DMD backend now in D

2018-11-12 Thread rikki cattermole via Digitalmars-d-announce
On 13/11/2018 12:12 AM, Jacob Carlborg wrote: On 2018-11-12 03:37, Walter Bright wrote: On 11/11/2018 3:58 PM, Mike Franklin wrote: This is a significant milestone.  Congratulations, Walter! Many people helped out with this, too. There are still a few .c files in

Re: DMD backend now in D

2018-11-12 Thread Jacob Carlborg via Digitalmars-d-announce
On 2018-11-12 00:40, Walter Bright wrote: As: https://github.com/dlang/dmd/pull/8946 removes the header files for the old C++ code! BTW, this is great news :) -- /Jacob Carlborg

Re: DMD backend now in D

2018-11-12 Thread Jacob Carlborg via Digitalmars-d-announce
On 2018-11-12 03:37, Walter Bright wrote: On 11/11/2018 3:58 PM, Mike Franklin wrote: This is a significant milestone. Congratulations, Walter! Many people helped out with this, too. There are still a few .c files in https://github.com/dlang/dmd/tree/master/src/dmd/backend, so what's the

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Jacob Carlborg via Digitalmars-d-announce
On 2018-11-12 10:45, Mike Parker wrote: DIP 1015, "Deprecation and removal of implicit conversion from integer and character literals to bool, has been rejected, primarily on the grounds that it is factually incorrect in treating bool as a type distinct from other integral types. The TL;DR is

Re: xlsxd: A Excel xlsx writer

2018-11-12 Thread Robert Schadek via Digitalmars-d-announce
On Saturday, 10 November 2018 at 10:55:04 UTC, Dave wrote: Could you please elaborate a bit on your workflow for D with Vim? E.g. what do you use for debugging, refactoring, ... ? I had a lot of functions looking like this void chart_axis_set_name(lxw_chart_axis* handle, const(char)*

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Nicholas Wilson via Digitalmars-d-announce
On Monday, 12 November 2018 at 10:05:09 UTC, Jonathan M Davis wrote: I was hoping that this DIP was convincing enough, and its failure is certainly disappointing. Indeed.

Re: DMD backend now in D

2018-11-12 Thread bauss via Digitalmars-d-announce
On Sunday, 11 November 2018 at 23:40:16 UTC, Walter Bright wrote: As: https://github.com/dlang/dmd/pull/8946 removes the header files for the old C++ code! This makes me happy.

Re: DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Jonathan M Davis via Digitalmars-d-announce
On Monday, November 12, 2018 2:45:14 AM MST Mike Parker via Digitalmars-d- announce wrote: > DIP 1015, "Deprecation and removal of implicit conversion from > integer and character literals to bool, has been rejected, > primarily on the grounds that it is factually incorrect in > treating bool as a

DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

2018-11-12 Thread Mike Parker via Digitalmars-d-announce
DIP 1015, "Deprecation and removal of implicit conversion from integer and character literals to bool, has been rejected, primarily on the grounds that it is factually incorrect in treating bool as a type distinct from other integral types. The TL;DR is that the DIP is trying to change