[std.regex] Set operations with unicode properties.

2017-10-30 Thread Tobias Pankrath via Digitalmars-d-learn
Greetings, I need to match any character, except control characters and some other exceptions and thought this would be a good usecase to use character classes and set operations. Can I combine this with unicode properties?, e.g: any Charactor that is not a control character and not ';' or '

Re: Associative arrays with keys containing mutable indirections

2017-10-30 Thread Tony via Digitalmars-d-learn
I prefer the built-in associative array over using some template library. It has the clean look and ease-of-use that you get with a similar data structure in dynamic languages like Python. I consider it a top feature of D.

Re: using .init reliably

2017-10-30 Thread Alex via Digitalmars-d-learn
Sorry for dig out this posting, but this one is more recent, than http://forum.dlang.org/thread/k15of5$22ub$1...@digitalmars.com?page=1 and my question is just beyond the two: I'm with you, regarding that the standard init property should not be overridden. But how about to override it with a

Re: Associative arrays with keys containing mutable indirections

2017-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/30/17 6:49 AM, Tony wrote: I prefer the built-in associative array over using some template library. It has the clean look and ease-of-use that you get with a similar data structure in dynamic languages like Python. I consider it a top feature of D. There is a misunderstanding here. The

Re: using .init reliably

2017-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/30/17 6:59 AM, Alex wrote: Sorry for dig out this posting, but this one is more recent, than http://forum.dlang.org/thread/k15of5$22ub$1...@digitalmars.com?page=1 and my question is just beyond the two: I'm with you, regarding that the standard init property should not be overridden. Bu

Re: using .init reliably

2017-10-30 Thread Alex via Digitalmars-d-learn
On Monday, 30 October 2017 at 15:03:25 UTC, Steven Schveighoffer wrote: This should also be disallowed. In order to know x.init means what it normally means, we shouldn't allow overriding it. This is the point of this thread, and the impetus for renaming of TypeInfo.init(). Yeah... my prob

Re: CSV with empty values for integer fields

2017-10-30 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 29 October 2017 at 15:45:23 UTC, Jesse Phillips wrote: Not really you'll need to parse it out as a string and do the conversion later. It probably would be good to support nullable!int pretty sure it doesn't currently. Should I raise a ticket on Bugzilla to address this?

Re: using .init reliably

2017-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/30/17 11:39 AM, Alex wrote: On Monday, 30 October 2017 at 15:03:25 UTC, Steven Schveighoffer wrote: This should also be disallowed. In order to know x.init means what it normally means, we shouldn't allow overriding it. This is the point of this thread, and the impetus for renaming of T

if (int bar = .. bug or some thing

2017-10-30 Thread Joel via Digitalmars-d-learn
The following code assert fails (bar == 1, not -10!). I've wasted a bit of time because of this happening. void main() { if (int bar = foo() != 0) { assert(bar == -10); } } auto foo() { return -10; }

Re: if (int bar = .. bug or some thing

2017-10-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 31, 2017 04:08:12 Joel via Digitalmars-d-learn wrote: > The following code assert fails (bar == 1, not -10!). I've wasted > a bit of time because of this happening. > > void main() { > if (int bar = foo() != 0) { > assert(bar == -10); > } > } > > auto foo() { > retur

Re: if (int bar = .. bug or some thing

2017-10-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 31 October 2017 at 04:08:12 UTC, Joel wrote: if (int bar = foo() != 0) { Not a bug, but I do think it is an iffy design. That is more like: int bar; if(bar = (foo() != 0)) so the foo != 0 is evaluated first, which ends up being boolean true or false, then THAT true/false

Re: if (int bar = .. bug or some thing

2017-10-30 Thread Joel via Digitalmars-d-learn
Ok, thanks guys.

Re: if (int bar = .. bug or some thing

2017-10-30 Thread codephantom via Digitalmars-d-learn
On Tuesday, 31 October 2017 at 04:27:27 UTC, Joel wrote: Ok, thanks guys. why not throw in some UFCS too...just because you can ;-) import std.stdio; void main() { int foo; if (foo.bar != 0) // would be nice if I could do: (int foo.bar != 0) { throw new Exception("foo.b