Re: weird empty string

2017-05-12 Thread mogu via Digitalmars-d
On Saturday, 13 May 2017 at 00:59:14 UTC, Stanislav Blinov wrote: On Saturday, 13 May 2017 at 00:36:55 UTC, mogu wrote: ```d if (null) "1".writeln; if ("") "2".writeln; if ("" == null) "3".writeln; ``` Output: 2 3 How to understand this? Boolean conversion on an array works on ar

weird empty string

2017-05-12 Thread mogu via Digitalmars-d
```d if (null) "1".writeln; if ("") "2".writeln; if ("" == null) "3".writeln; ``` Output: 2 3 How to understand this?

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread mogu via Digitalmars-d
On Monday, 3 April 2017 at 18:24:31 UTC, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very nice. C++ is quickly catching up to D in a lot of areas,

Should d runtime catch SIGFPE and throw an exception?

2017-02-13 Thread mogu via Digitalmars-d
As I know, native languages like rust, go, pony, crystal all can recover from dividing zero fault.

Re: If Statement with Declaration

2016-11-03 Thread mogu via Digitalmars-d
On Thursday, 3 November 2016 at 22:32:17 UTC, Stefan Koch wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: [..

Re: The build is broken when using gcc 6

2016-10-26 Thread mogu via Digitalmars-d
On Thursday, 27 October 2016 at 04:33:30 UTC, Stefan Koch wrote: On Thursday, 27 October 2016 at 02:36:13 UTC, Stefam Koch wrote: Trivial. Fix is comeing. Okay it was less trivial then it should have been. Great job gcc. -Wno-narrowing does not cover all g++ tasks.

Re: D Uniform initialization {}

2016-10-22 Thread mogu via Digitalmars-d
On Sunday, 23 October 2016 at 01:31:47 UTC, Seb wrote: On Saturday, 22 October 2016 at 21:26:53 UTC, Patric Dexheimer wrote: S[] s = [{ 1, 2 }]; Nice, did´n knew that it worked. On Friday, 21 October 2016 at 21:41:16 UTC, Daniel Kozak wrote: Because there is no need. In c++ it is disaster beca

Re: "for" statement issue

2016-10-21 Thread mogu via Digitalmars-d
Allow new syntax makes codes simpler in some cases: writeln({ int a = 5; return a + 5; }()); => writeln{ int a = 5; return a + 5; }(); [1,2,3].fold!((a, b) => a + b).writeln; => [1,2,3].fold!{a, b => a + b}.writeln;

Re: "for" statement issue

2016-10-21 Thread mogu via Digitalmars-d
On Friday, 21 October 2016 at 14:22:27 UTC, Steven Schveighoffer wrote: On 10/21/16 10:12 AM, Temtaime wrote: On Friday, 21 October 2016 at 13:42:49 UTC, Adam D. Ruppe wrote: On Friday, 21 October 2016 at 13:33:26 UTC, Stefan Koch wrote: [...] Eh, that's exactly what the language rules say s

Re: dmd or phobos were broken in ubuntu 16.10 d-apt

2016-10-21 Thread mogu via Digitalmars-d
On Friday, 21 October 2016 at 10:05:40 UTC, Daniel Kozak wrote: Or you can build your own version of dmd with PIC enabled and add -fPIC to /etc/dmd.conf I rebuilded phobos and druntime with -fPIC and replaced the static libphobos2.a. Now it works well. But I have to specified -fPIC to dmd eac

Re: Pattern matching in D?

2016-10-21 Thread mogu via Digitalmars-d
On Friday, 21 October 2016 at 06:50:26 UTC, Dennis Ritchie wrote: The problem is that D is not macros, and the implementation of pattern matching without macros will not be very good. In turn, the implementation of macros in D - this is also not a good idea. Agreed. D has not macro, this ma

dmd or phobos were broken in ubuntu 16.10 d-apt

2016-10-21 Thread mogu via Digitalmars-d
$ dmd hello.d /usr/bin/ld: hello.o: relocation R_X86_64_32 against symbol `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(exception_224_3b4.o): relocation R_X86_64_32 against symbol `__dmd_personality_

Re: dlang-vscode

2016-09-06 Thread mogu via Digitalmars-d
On Tuesday, 6 September 2016 at 05:38:28 UTC, Manu wrote: On 6 September 2016 at 14:22, Daniel Kozak via Digitalmars-d wrote: Dne 6.9.2016 v 03:41 Manu via Digitalmars-d napsal(a): On 6 September 2016 at 09:51, John Colvin via Digitalmars-d wrote: On Monday, 5 September 2016 at 22:17:59 U

Re: associative arrays: how to insert key and return pointer in 1 step to avoid searching twice

2016-09-05 Thread mogu via Digitalmars-d
On Tuesday, 6 September 2016 at 01:17:00 UTC, Timothee Cour wrote: is there a way to do this efficiently with associative arrays: aa[key]=value; auto ptr=key in aa; without suffering the cost of the 2nd search (compiler should know ptr during aa[key]=value but it's not exposed it seems) auto

Template argument deduction for class templates adopted in cpp17

2016-07-25 Thread mogu via Digitalmars-d
Link: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r1.html And we have DIP40: http://wiki.dlang.org/DIP40 Is someone there to renew it in new DIPs repo? T.T

Re: Gravatar is blocked by GFW

2016-06-30 Thread mogu via Digitalmars-d
On Friday, 1 July 2016 at 01:43:40 UTC, Seb wrote: On Thursday, 30 June 2016 at 23:49:16 UTC, mogu wrote: Could dlang.org filter IP addresses from China and use another gravatar mirrors? Here's one solution: https://wordpress.org/plugins/wp-duoshuo-gravatar/ Now I have to always open the VPN t

Re: Gravatar is blocked by GFW

2016-06-30 Thread mogu via Digitalmars-d
On Friday, 1 July 2016 at 01:35:51 UTC, Jack Stouffer wrote: On Thursday, 30 June 2016 at 23:49:16 UTC, mogu wrote: Could dlang.org filter IP addresses from China and use another gravatar mirrors? Here's one solution: https://wordpress.org/plugins/wp-duoshuo-gravatar/ Now I have to always open

Gravatar is blocked by GFW

2016-06-30 Thread mogu via Digitalmars-d
Could dlang.org filter IP addresses from China and use another gravatar mirrors? Here's one solution: https://wordpress.org/plugins/wp-duoshuo-gravatar/ Now I have to always open the VPN to access the forum. This may blocks many people interested in D from China. Please help.

Re: DIP66 v1.1 (Multiple) alias this.

2016-06-26 Thread mogu via Digitalmars-d
On Monday, 27 June 2016 at 00:13:46 UTC, mogu wrote: On Friday, 8 May 2015 at 13:57:56 UTC, Andrea Fontana wrote: Is "multiple alias this" implementation planned in near future? It could be useful for a project of mine :) I need it too, and also do static inheritance. http://wiki.dlang.org/DIP

Re: DIP66 v1.1 (Multiple) alias this.

2016-06-26 Thread mogu via Digitalmars-d
On Friday, 8 May 2015 at 13:57:56 UTC, Andrea Fontana wrote: On Saturday, 27 December 2014 at 12:28:34 UTC, Joseph Rushton Wakeling wrote: On 26/12/14 19:53, Daniel N via Digitalmars-d wrote: Anyway considering the new ways of working, when using the -dip switch for the initial few releases, th

Re: C++17 is feature complete

2016-06-26 Thread mogu via Digitalmars-d
On Sunday, 26 June 2016 at 22:32:55 UTC, Walter Bright wrote: On 6/26/2016 10:18 AM, Enamex wrote: - template arguments that accept constant values of any type whatsoever 'template'; Still adding D features, I see! Now cpp has structured bindings although it's a limited version of match.

Re: Weird compiler

2016-06-19 Thread mogu via Digitalmars-d
On Sunday, 19 June 2016 at 15:06:40 UTC, David Nadlinger wrote: On Sunday, 19 June 2016 at 14:05:22 UTC, mogu wrote: It's awful that I compile a little 64bit program(or -m32mscoff) in windows must have visual studio which has tremendous size installed even though I only need a linker. It's wei

Re: Weird compiler

2016-06-19 Thread mogu via Digitalmars-d
On Sunday, 19 June 2016 at 15:06:40 UTC, David Nadlinger wrote: On Sunday, 19 June 2016 at 14:05:22 UTC, mogu wrote: It's awful that I compile a little 64bit program(or -m32mscoff) in windows must have visual studio which has tremendous size installed even though I only need a linker. It's wei

Re: Weird compiler

2016-06-19 Thread mogu via Digitalmars-d
On Sunday, 19 June 2016 at 15:00:07 UTC, Rene Zwanenburg wrote: Don't underestimate the value of fast compilation, it's incredibly useful while writing code. Sorry for my tone. After waste so much time, I've been a little mad. :( In fact, I'm an advocator of meta-programming.

Re: Weird compiler

2016-06-19 Thread mogu via Digitalmars-d
Moreover, I wonder if D is really a cross-platform programming language?! The official dmd only supports x86 structure. You can never build a project with third party static library in windows independently. And how I can build an android program? LDC2? So what dmd is? Only for a bit faster com

Weird compiler

2016-06-19 Thread mogu via Digitalmars-d
Today, I'm working on a private GUI tool which must be run at linux and windows. It's awful that I compile a little 64bit program(or -m32mscoff) in windows must have visual studio which has tremendous size installed even though I only need a linker. It's weird that a compiler compiles to binary

Re: We want to start the 'Programming In D 'in Chinese, do you have any good suggestions?

2016-06-11 Thread mogu via Digitalmars-d
On Saturday, 11 June 2016 at 03:19:52 UTC, Meta wrote: On Saturday, 11 June 2016 at 00:38:24 UTC, mogu wrote: 编 可以是 编写 的缩写 编 could be short for 编写(write) 程 可以是 程序 的缩写 程 could be short for 程序(program) 编程 即 编写程序 So 编程 means writing programs aka programming. 谢谢你纠正我,说中文不容易的。 哪里哪里,中文的确很难,但同时也是最有魅

Re: We want to start the 'Programming In D 'in Chinese, do you have any good suggestions?

2016-06-10 Thread mogu via Digitalmars-d
On Friday, 10 June 2016 at 21:32:47 UTC, Meta wrote: On Friday, 10 June 2016 at 20:47:16 UTC, Ola Fosheim Grøstad wrote: On Friday, 10 June 2016 at 15:04:52 UTC, Ali Çehreli wrote: src/ders/d.cn/编程在D.print.pdf src/ders/d.cn/编程在D.pdf Is "programming" composed as "edit journey" in chinese?

Re: Free the DMD backend

2016-05-29 Thread mogu via Digitalmars-d
On Sunday, 29 May 2016 at 10:56:57 UTC, Russel Winder wrote: This is why LDC should be seen in the D community as the main production toolchain, and Dub should default to LDC for compilation. Agreed. Especially, LDC supports more platform.

Re: dmd failed or dub wrong?

2016-05-24 Thread mogu via Digitalmars-d
On Wednesday, 25 May 2016 at 03:07:31 UTC, Mike Parker wrote: This is because dub is apparently compiling with warnings ... Thanks for your answer. And sorry for that this thread should be in Learn section now i think.

dmd failed or dub wrong?

2016-05-24 Thread mogu via Digitalmars-d
I use dub 0.9.25, DMD64 D Compiler v2.071.0. Create a minimal project and write the following codes in main function. ``` import std.math; long i = 0; i += 3.5.floor; ``` Then run dub will get a warning and dmd failed. ``` source/app.d(4,7): Warning: long += double is performing truncating co

Re: Killing the comma operator

2016-05-10 Thread mogu via Digitalmars-d
On Tuesday, 10 May 2016 at 21:49:10 UTC, Nordlöw wrote: On Tuesday, 10 May 2016 at 21:33:47 UTC, Stefan Koch wrote: On Tuesday, 10 May 2016 at 21:30:35 UTC, Timon Gehr wrote: Kill it. I agree. Agreed. Builtin tuple syntax is far more useful. +1. And personally, match is expected then.