Re: getopt: How does arraySep work?

2020-07-16 Thread Jon Degenhardt via Digitalmars-d-learn
On Thursday, 16 July 2020 at 17:40:25 UTC, Steven Schveighoffer wrote: On 7/16/20 1:13 PM, Andre Pany wrote: On Thursday, 16 July 2020 at 05:03:36 UTC, Jon Degenhardt wrote: On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote: [...] An enhancement is likely to hit some corner-cases

Re: getopt: How does arraySep work?

2020-07-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/16/20 1:13 PM, Andre Pany wrote: On Thursday, 16 July 2020 at 05:03:36 UTC, Jon Degenhardt wrote: On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote: [...] An enhancement is likely to hit some corner-cases involving list termination requiring choices that are not fully

Re: getopt: How does arraySep work?

2020-07-16 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 16 July 2020 at 05:03:36 UTC, Jon Degenhardt wrote: On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote: [...] An enhancement is likely to hit some corner-cases involving list termination requiring choices that are not fully generic. Any time a legal list value looks

Re: getopt: How does arraySep work?

2020-07-15 Thread Jon Degenhardt via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote: On Tuesday, 14 July 2020 at 15:48:59 UTC, Andre Pany wrote: On Tuesday, 14 July 2020 at 14:33:47 UTC, Steven Schveighoffer wrote: On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say

Re: getopt: How does arraySep work?

2020-07-15 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 15:48:59 UTC, Andre Pany wrote: On Tuesday, 14 July 2020 at 14:33:47 UTC, Steven Schveighoffer wrote: On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say "parameters are added sequentially" or something like that, instead

Re: getopt: How does arraySep work?

2020-07-14 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 14:33:47 UTC, Steven Schveighoffer wrote: On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say "parameters are added sequentially" or something like that, instead of "separation by whitespace".

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 10:22 AM, Steven Schveighoffer wrote: The documentation needs updating, it should say "parameters are added sequentially" or something like that, instead of "separation by whitespace". https://github.com/dlang/phobos/pull/7557 -Steve

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 10:05 AM, Steven Schveighoffer wrote: Hm... that looks like it IS actually expecting to do what Andre wants. It's adding each successive parameter. If that doesn't work, then there's something wrong with the logic that decides whether a parameter is part of the previous argument

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 9:51 AM, Anonymouse wrote: On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply

Re: getopt: How does arraySep work?

2020-07-14 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 13:40:44 UTC, Steven Schveighoffer wrote: The whitespace separator doesn't get to your program. args is: ["sample", "--modelicalibs", "a", "b"] There is no separator in the parameter to --modelicalibs, it's just "a". What you need to do is: dmd -run sample.d

Re: getopt: How does arraySep work?

2020-07-14 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply not the case.

Re: getopt: How does arraySep work?

2020-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/20 7:12 AM, Andre Pany wrote: Hi, by reading the documentation of std.getopt I would assume, this is a valid call dmd -run sample.d --modelicalibs a b ``` d import std; void main(string[] args) {     string[] modelicaLibs;     getopt(args, "modelicalibs", );    

getopt: How does arraySep work?

2020-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, by reading the documentation of std.getopt I would assume, this is a valid call dmd -run sample.d --modelicalibs a b ``` d import std; void main(string[] args) { string[] modelicaLibs; getopt(args, "modelicalibs", ); assert(modelicaLibs == ["a", "b"]); } ``` but it fails,

How does this work?

2014-11-23 Thread Freddy via Digitalmars-d-learn
I know what this does, but can someone explain how it works? static if((typeof((inout int=0){ })));

Re: How does this work?

2014-11-23 Thread ketmar via Digitalmars-d-learn
On Sun, 23 Nov 2014 22:51:48 + Freddy via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I know what this does, but can someone explain how it works? static if((typeof((inout int=0){ }))); it was here somewhere. this is, as you can see, a lambda. `typeof()` can

Re: How does GC.addRange work?

2014-09-24 Thread kiran kumari via Digitalmars-d-learn
On Saturday, 20 September 2014 at 20:14:36 UTC, Gary Willoughby wrote: How does GC.addRange work? i.e. what is it doing? I'm assuming reading the docs that it adds a range for the GC to scan but what actually happens? Does the GC look into this range and check for the existence of pointers

Re: How does GC.addRange work?

2014-09-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/21/14 3:00 PM, Gary Willoughby wrote: On Saturday, 20 September 2014 at 23:08:08 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 20 Sep 2014 22:21:13 + Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: So zeroing values will inform the GC the

Re: How does GC.addRange work?

2014-09-21 Thread Gary Willoughby via Digitalmars-d-learn
On Saturday, 20 September 2014 at 23:08:08 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 20 Sep 2014 22:21:13 + Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: So zeroing values will inform the GC the reference has gone? yes. Thanks, i just wanted

How does GC.addRange work?

2014-09-20 Thread Gary Willoughby via Digitalmars-d-learn
How does GC.addRange work? i.e. what is it doing? I'm assuming reading the docs that it adds a range for the GC to scan but what actually happens? Does the GC look into this range and check for the existence of pointers it's currently managing? For example, if i nulled a pointer in the range

Re: How does GC.addRange work?

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 20:14:35 + Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: How does GC.addRange work? i.e. what is it doing? I'm assuming reading the docs that it adds a range for the GC to scan but what actually happens? Does the GC look

Re: How does GC.addRange work?

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 22:21:13 + Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: So zeroing values will inform the GC the reference has gone? yes. signature.asc Description: PGP signature

How does noexcept work?

2013-11-19 Thread Jeroen Bollen
If I have a function: @safe pure void functionName() { return; } Where do I put the noexcept?

Re: How does noexcept work?

2013-11-19 Thread Namespace
On Tuesday, 19 November 2013 at 18:01:19 UTC, Jeroen Bollen wrote: If I have a function: @safe pure void functionName() { return; } Where do I put the noexcept? Did you mean nothrow? You can put it unfortunately on both sides. left: @safe pure nothrow void

Re: How does noexcept work?

2013-11-19 Thread Jeroen Bollen
On Tuesday, 19 November 2013 at 18:09:29 UTC, Namespace wrote: On Tuesday, 19 November 2013 at 18:01:19 UTC, Jeroen Bollen wrote: If I have a function: @safe pure void functionName() { return; } Where do I put the noexcept? Did you mean nothrow? You can put it

How does immutable work.

2012-08-09 Thread egslava
. But why the output does look like this? How does this construction work? Why memory addresses are same, assign is working, but value of immutable variable doesn't change? I would even think, that in compile-time compiler changes writeln(x) to writeln(10), but why we can dereference x?

Re: How does immutable work.

2012-08-09 Thread Simen Kjaeraas
just one more time located memory and copied value of variable. But why the output does look like this? How does this construction work? Why memory addresses are same, assign is working, but value of immutable variable doesn't change? I would even think, that in compile-time compiler

Re: How does immutable work.

2012-08-09 Thread Ali Çehreli
like a valid address to me. In this case, I would think - we just one more time located memory and copied value of variable. But why the output does look like this? How does this construction work? Why memory addresses are same, assign is working, but value of immutable variable doesn't change

Re: How does immutable work.

2012-08-09 Thread David Nadlinger
On Thursday, 9 August 2012 at 17:25:48 UTC, egslava wrote: If I will change immutable to const output will not changed. But why? Why output is look like this? Just to repeat the gist of it: immutable is a guarantee that the value stored in the variable will never change, and the compiler is

Re: How does immutable work.

2012-08-09 Thread Chris Cain
In addition to what everyone else said, I think it's important to also say that, in general, you should _not_ cast away immutable or const like you did. As far as I'm concerned, it's a programming error. It's possible that future compilers might have immutable data stored in Read-Only Memory

How does this work ?

2012-04-19 Thread Somedude
I'm going through a number of bug reports, trying to reproduce the problems and see what can be closed easily (i.e non reproduced, correct behaviour, etc), and I just came accross http://d.puremagic.com/issues/show_bug.cgi?id=7326 titled write interprets enum with byte backing type as a character

Re: How does this work ?

2012-04-19 Thread Andrej Mitrovic
On 4/19/12, Somedude lovelyd...@mailmetrash.com wrote: Can anyone explain me if it is the correct behaviour, and if yes, why ? It's fixed now and we can close this down. I think it was related to formatting issues, that's all.

Re: how does range.put work

2009-08-08 Thread Jos van Uden
Oliver wrote: The source code for the standard library comes with the compiler. If you look in std\array.d, you find this around line 279 (reflowed for readability): void put(T, E)(ref T[] a, E e) { assert(a.length); a[0] = e; a = a[1 .. $]; } Would anybody care to explain what this

Re: how does range.put work

2009-08-08 Thread Daniel Keep
Jos van Uden wrote: Oliver wrote: The source code for the standard library comes with the compiler. If you look in std\array.d, you find this around line 279 (reflowed for readability): void put(T, E)(ref T[] a, E e) { assert(a.length); a[0] = e; a = a[1 .. $]; } Would anybody

Re: how does range.put work

2009-08-08 Thread Jos van Uden
Daniel Keep wrote: No; read the code. Before the put, a and b are pointing to the same span of memory. a.put(5) puts the value 5 into the front (first element) of the array, then advances the array. However, put can't see b, so it doesn't get updated along with a. The end result is that b =

Re: how does range.put work

2009-08-07 Thread O.K.
Good point ! Use the [S/F]o[u]rce ! Thx, Oliver O.K. wrote: Hello, could someone plz clearify what the exact semantics of put are ? Put works with an appender, but gives me a runtime exception when using an array. Best regards, Oliver The source code for the standard library

how does range.put work

2009-08-06 Thread O.K.
Hello, could someone plz clearify what the exact semantics of put are ? Put works with an appender, but gives me a runtime exception when using an array. Best regards, Oliver

Re: how does range.put work

2009-08-06 Thread Daniel Keep
O.K. wrote: Hello, could someone plz clearify what the exact semantics of put are ? Put works with an appender, but gives me a runtime exception when using an array. Best regards, Oliver The source code for the standard library comes with the compiler. If you look in std\array.d, you