Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Juraj Mojzis via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: void f(string s, int i = 0); f(i"hello $a"); // silent unwanted bahviour. ? It is lowered to: f("hello %s", a); as designed. I don't know what's unwanted about it. void print_many(string msg, int cnt = 1) {

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/25/2020 8:04 AM, Arine wrote: Is this really the line of thinking going on here? It seems Walter has these arbitrary rules he's following which led up to the impractical and buggy solution that was DIP1027. Rules aren't meant to be followed blindly. See what I mean about "no consensus

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/25/2020 1:36 AM, aliak wrote: This may have already been answered in the other threads, but I was just wondering if anyone managed to propose a way to avoid this scenario with DIP1027? void f(string s, int i = 0); f(i"hello $a"); // silent unwanted bahviour. ? It is lowered to:

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread aliak via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: On 2/25/2020 1:36 AM, aliak wrote: This may have already been answered in the other threads, but I was just wondering if anyone managed to propose a way to avoid this scenario with DIP1027? void f(string s, int i = 0);

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/25/2020 9:44 AM, H. S. Teoh wrote: On Mon, Feb 24, 2020 at 10:54:34PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...] Writing that an implementation must refer to specific templates implies that the behavior is customizable by the user via modifying those templates. I think

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/25/2020 7:04 AM, Steven Schveighoffer wrote: On 2/25/20 1:54 AM, Walter Bright wrote: Were you proposing that an i"" be a different type? (DIP 1027 did not assign a type to it at all.) No, I proposed that the first element of the tuple be specified as a new spec-defined type instead

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/24/2020 4:07 PM, Steven Schveighoffer wrote: To ensure that it cannot be intercepted. See my reply to H.S. Teoh which addresses this.

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/26/2020 2:02 AM, Juraj Mojzis wrote: void print_many(string msg, int cnt = 1) {     foreach(i; 0 .. cnt) writeln(msg); } int apple_cnt = 4; print_many(i"I have $apple_cnt apples."); expected: I have 4 apples. Doing what you want would require a runtime GC allocated string.

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread aliak via Digitalmars-d-announce
On Tuesday, 25 February 2020 at 16:04:59 UTC, Arine wrote: ``How to distinguish a different type? Use a different type. No, is there another simpler way to do that instead?`` Is this really the line of thinking going on here? It seems Walter has these arbitrary rules he's following which led

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Juraj Mojzis via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 10:02:15 UTC, Juraj Mojzis wrote: On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: void print_many(string msg, int cnt = 1) { foreach(i; 0 .. cnt) writeln(msg); } int apple_cnt = 4; print_many(i"I have $apple_cnt apples."); expected:

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Adam D. Ruppe via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 12:18:07 UTC, FeepingCreature wrote: But to be thrice fair, Adam/Steven's proposal would work with the minor extension `f(i"hello $a".format)`/`f(i"hello $a".to!string)`, in keeping with the trend of GC use requiring explicit opt-in. Actually, thanks to the

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Steven Schveighoffer via Digitalmars-d-announce
On 2/26/20 4:57 AM, Walter Bright wrote: On 2/25/2020 9:44 AM, H. S. Teoh wrote: On Mon, Feb 24, 2020 at 10:54:34PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...] Writing that an implementation must refer to specific templates implies that the behavior is customizable by the

Beta 2.091.0

2020-02-26 Thread Martin Nowak via Digitalmars-d-announce
Glad to announce the first beta for the 2.091.0 release, ♥ to the 55 contributors. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.091.0.html Due to updating several components in the build pipeline, this beta and release are unfortunately delayed. 2.091.0 is now planned to

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Petar via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: On 2/25/2020 1:36 AM, aliak wrote: This may have already been answered in the other threads, but I was just wondering if anyone managed to propose a way to avoid this scenario with DIP1027? void f(string s, int i = 0);

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread FeepingCreature via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 11:13:12 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: It is lowered to: f("hello %s", a); as designed. I don't know what's unwanted about it. In all other languages with string interpolation

Re: Blog post on calling C from Python via D

2020-02-26 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 19 February 2020 at 16:30:04 UTC, Atila Neves wrote: https://atilaoncode.blog/2020/02/19/want-to-call-c-from-python-use-d/ Discussion elsewhere: https://www.reddit.com/r/programming/comments/f6agvt/want_to_call_c_from_python_use_d/ https://news.ycombinator.com/item?id=22365166

Re: Beta 2.091.0

2020-02-26 Thread Andre Pany via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 12:17:43 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.091.0 release, ♥ to the 55 contributors. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.091.0.html Due to updating several components in the build pipeline,

Re: Beta 2.091.0

2020-02-26 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 12:17:43 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.091.0 release, ♥ to the 55 contributors. [snip] I'm happy to see those Windows install improvements. In the changelog, it mentions isClose, but I didn't see that listed in the

Re: Beta 2.091.0

2020-02-26 Thread Andre Pany via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 14:11:58 UTC, Andre Pany wrote: On Wednesday, 26 February 2020 at 12:17:43 UTC, Martin Nowak wrote: Thank you so much Rainer for adding the 64 bit dmd compiler to the windows installation package. Also building DMD with LDC is such a huge improvement. Thank

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Adam D. Ruppe via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:57:58 UTC, Walter Bright wrote: Requiring the compiler to use a specific template that is not specified by the user has no place in a language specification (and therefore no place in a proposed language change). I think more naturally in D code rather

Re: Blog post on calling C from Python via D

2020-02-26 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 17:39:14 UTC, jmh530 wrote: On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: [snip] A lot of the comments were about how stupid I was for not just using ctypes or cffi. I tried today and both of them are horrible. As I say in the blog post

Re: Blog post on calling C from Python via D

2020-02-26 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Feb 26, 2020 at 08:45:31PM +, Atila Neves via Digitalmars-d-announce wrote: > On Wednesday, 26 February 2020 at 17:39:14 UTC, jmh530 wrote: > > On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: > > > [snip] > > > > > > A lot of the comments were about how stupid I

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Arine via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 16:08:53 UTC, Adam D. Ruppe wrote: On Wednesday, 26 February 2020 at 15:41:48 UTC, Arine wrote: Yah, what's unwanted about that? To follow up on this, I expect a reply will be "the user ought to know how the feature works". This isn't a realistic

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/26/2020 3:13 AM, Petar Kirov [ZombineDev] wrote: In all other languages with string interpolation that I'm familiar with, `a` is not passed to the `i` parameter. All rely on a garbage collected string being generated as an intermediate variable.

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Adam D. Ruppe via Digitalmars-d-announce
On Thursday, 27 February 2020 at 00:21:36 UTC, Walter Bright wrote: So would DIP1027. We know. It is *almost* there, the format string idea is a good one. But DIP1027 had a fatal flaw: it made type safety impossible. One small change - wrapping the format string in a new type while keeping

Re: Blog post on calling C from Python via D

2020-02-26 Thread sarn via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 17:23:51 UTC, Meta wrote: On Wednesday, 26 February 2020 at 17:11:18 UTC, bachmeier wrote: There needs to be a variant of "mansplaining" modified for Python users. Agreed, and there also needs to be a variant of prison, modified for people who post dumb

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
You can also write: print(format(i"I have $apple_cnt apples")); void print(string s) { print_many(s); } and get the behavior you're looking for.

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread FeepingCreature via Digitalmars-d-announce
On Thursday, 27 February 2020 at 03:50:35 UTC, Walter Bright wrote: On 2/26/2020 4:46 PM, Adam D. Ruppe wrote: But DIP1027 had a fatal flaw: it made type safety impossible. I don't see how that is true. Because it turned a format string into a list of built-in types indistinguishable from

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/26/2020 5:19 AM, Steven Schveighoffer wrote: We can do it without specifying that it's a template or the name of that template. That isn't what was proposed. I seriously suggest preparing a DIP. Bits and pieces spread out over multiple posts and multiple threads is not working. But

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/26/2020 4:46 PM, Adam D. Ruppe wrote: But DIP1027 had a fatal flaw: it made type safety impossible. I don't see how that is true.

Re: Blog post on calling C from Python via D

2020-02-26 Thread Ali Çehreli via Digitalmars-d-announce
On 2/26/20 6:51 AM, Atila Neves wrote: My followup: https://atilaoncode.blog/2020/02/26/seriously-just-use-d-to-call-c-from-python/ Could someone please post this on Reddit and Hacker News. Thanks... Ali

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Walter Bright via Digitalmars-d-announce
On 2/26/2020 4:18 AM, FeepingCreature wrote: But to be thrice fair, Adam/Steven's proposal would work with the minor extension [...] So would DIP1027.

Re: Blog post on calling C from Python via D

2020-02-26 Thread Panke via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: On Wednesday, 19 February 2020 at 16:30:04 UTC, Atila Neves wrote: https://atilaoncode.blog/2020/02/19/want-to-call-c-from-python-use-d/ Discussion elsewhere:

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Arine via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote: On 2/25/2020 1:36 AM, aliak wrote: This may have already been answered in the other threads, but I was just wondering if anyone managed to propose a way to avoid this scenario with DIP1027? void f(string s, int i = 0);

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Arine via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 10:36:34 UTC, aliak wrote: On Tuesday, 25 February 2020 at 16:04:59 UTC, Arine wrote: ``How to distinguish a different type? Use a different type. No, is there another simpler way to do that instead?`` Is this really the line of thinking going on here? It

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Adam D. Ruppe via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 15:41:48 UTC, Arine wrote: Yah, what's unwanted about that? To follow up on this, I expect a reply will be "the user ought to know how the feature works". This isn't a realistic expectation. This is why I put in my little narrative in the new DIP, though

Re: DIP 1027---String Interpolation---Format Assessment

2020-02-26 Thread Arine via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 09:57:58 UTC, Walter Bright wrote: On 2/25/2020 9:44 AM, H. S. Teoh wrote: On Mon, Feb 24, 2020 at 10:54:34PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...] Writing that an implementation must refer to specific templates implies that the

Re: Blog post on calling C from Python via D

2020-02-26 Thread Atila Neves via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 16:17:06 UTC, Panke wrote: On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: [...] Very good read. I my opinion your work with integrating different languages with D is the most exciting stuff going on in the moment. If you had an RSS

Re: Blog post on calling C from Python via D

2020-02-26 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: On Wednesday, 19 February 2020 at 16:30:04 UTC, Atila Neves wrote: https://atilaoncode.blog/2020/02/19/want-to-call-c-from-python-use-d/ Discussion elsewhere:

Re: Blog post on calling C from Python via D

2020-02-26 Thread Meta via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 17:11:18 UTC, bachmeier wrote: There needs to be a variant of "mansplaining" modified for Python users. Agreed, and there also needs to be a variant of prison, modified for people who post dumb comments on Hacker News.

Re: Blog post on calling C from Python via D

2020-02-26 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves wrote: [snip] A lot of the comments were about how stupid I was for not just using ctypes or cffi. I tried today and both of them are horrible. As I say in the blog post below, either they didn't read the article (people on the

Re: Blog post on calling C from Python via D

2020-02-26 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 26 February 2020 at 16:17:06 UTC, Panke wrote: [snip] If you had an RSS feed, I would subscribe. Wasn't there a planet D in the past? I've been subscribed on feedly without any issues. I can't recall what I actually did to subscribe as I can't seem to replicate it, but you