Re: [OT] Converting booleans to numbers

2017-09-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 20, 2017 21:13:58 nkm1 via Digitalmars-d-learn wrote: > OTOH, booleans being numbers is a source of some bugs (just like > other cases of weak typing). Not a ton of bugs, but the utility > of implicit conversion to numbers is so unnoticeable that I'm > sure it's just not

Re: What the hell is wrong with D?

2017-09-20 Thread Azi Hassan via Digitalmars-d-learn
A general rule of thumb when it comes to operator precedence is that when in doubt, add parenthesis. On Wednesday, 20 September 2017 at 02:16:16 UTC, EntangledQuanta wrote: Your an idiot, Your Huh.

Re: [OT] Converting booleans to numbers

2017-09-20 Thread nkm1 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 19:25:58 UTC, Timon Gehr wrote: Actually, it is useful enough to have a Wikipedia page: https://en.wikipedia.org/wiki/Iverson_bracket Mmmm... "The notation was originally introduced by Kenneth E. Iverson in his programming language APL". APL... yeah :)

Re: [OT] Converting booleans to numbers

2017-09-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 19:25:58 UTC, Timon Gehr wrote: On 19.09.2017 23:17, nkm1 wrote: ... OTOH, booleans converting to numbers is a very questionable feature. > I certainly have never seen any good use for it. ... Actually, it is useful enough to have a Wikipedia page:

[OT] Converting booleans to numbers

2017-09-20 Thread Timon Gehr via Digitalmars-d-learn
On 19.09.2017 23:17, nkm1 wrote: ... OTOH, booleans converting to numbers is a very questionable feature. > I certainly have never seen any good use for it. ... Actually, it is useful enough to have a Wikipedia page: https://en.wikipedia.org/wiki/Iverson_bracket Example of a good use: void

Re: wstring hex literals

2017-09-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 16:26:46 UTC, Neia Neutuladh wrote: On Wednesday, 20 September 2017 at 15:04:08 UTC, jmh530 wrote: testing_utf16.d(5): Error: Truncated UTF-8 sequence testing_utf16.d(6):while evaluating: static assert((_error_) == (wstring )) Failed: ["dmd",

Communication was [Re: What the hell is wrong with D?]

2017-09-20 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 02:34:50 UTC, EntangledQuanta wrote: When they then make up excuses to try to justify the wrong and turn it in to a right, they deserved to be attacked. That isn't how it went down, you attacked then justification was provided. for someone that programs in

Re: wstring hex literals

2017-09-20 Thread Neia Neutuladh via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 15:04:08 UTC, jmh530 wrote: testing_utf16.d(5): Error: Truncated UTF-8 sequence testing_utf16.d(6):while evaluating: static assert((_error_) == (wstring )) Failed: ["dmd", "-unittest", "-v", "-o-", "testing_utf16.d", "-I."]

wstring hex literals

2017-09-20 Thread jmh530 via Digitalmars-d-learn
I don't seem to be having any issues making strings or dstrings from hex, but I run into some issues with wstrings. Of course, my knowledge of UTF-16 is limited, but I don't see any issues with the code below and I get some errors on the hex string literal. unittest { wchar data = 0x03C0;

Re: Choosing between __traits(compiles, { ... } ) and is(typeof( { ... } ))

2017-09-20 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 12:20:18 UTC, Stefan Koch wrote: Yes there are. Prefer __traits(compiles) it includes stricter visibility checks then is() does. 1. Can you give example of such visibility checks? 2. If so, should `isCopyable` (along with more defs in std.traits) be

Re: Choosing between __traits(compiles, { ... } ) and is(typeof( { ... } ))

2017-09-20 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 12:01:21 UTC, Nordlöw wrote: When is __traits(compiles, { ... } ) preferred over is(typeof( { ... } )) and vice versa when writing stuff like enum isCopyable(S) = is(typeof( { S foo = S.init; S copy = foo; } )); ? Further, are there cases

Choosing between __traits(compiles, { ... } ) and is(typeof( { ... } ))

2017-09-20 Thread Nordlöw via Digitalmars-d-learn
When is __traits(compiles, { ... } ) preferred over is(typeof( { ... } )) and vice versa when writing stuff like enum isCopyable(S) = is(typeof( { S foo = S.init; S copy = foo; } )); ? Further, are there cases where the two idioms aren't exchangable?

Re: Array merge and sort

2017-09-20 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 06:29:17 UTC, Vino.B wrote: Hi All, My code output's the below so can any one help me on hot to merege all tese array and sort the same. Output : [ Tuple!(string, string)("C:\\Temp\\TEST1\\BACKUP\\DND1.pdf", "2017-Sep-06 16:06:42") ] [ Tuple!(string,

Re: What the hell is wrong with D?

2017-09-20 Thread Jack Applegame via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:54:02 UTC, Steven Schveighoffer wrote: On 9/19/17 1:40 PM, EntangledQuanta wrote: The first returns x + w/2 and the second returns w/2! Did you mean (x + w) / 2 or x + (w / 2)? Stop being ambiguous! -Steve The best answer. :D

Array merge and sort

2017-09-20 Thread Vino.B via Digitalmars-d-learn
Hi All, My code output's the below so can any one help me on hot to merege all tese array and sort the same. Output : [ Tuple!(string, string)("C:\\Temp\\TEST1\\BACKUP\\DND1.pdf", "2017-Sep-06 16:06:42") ] [ Tuple!(string, string)("C:\\Temp\\TEST2\\EXPORT\\DND1.pdf", "2017-Sep-06