Learning D - first steps and best practices

2013-09-29 Thread Stefan Larsson
Hello, I have started my journey to learn D after using C/C++ and Python for many years. I am studying the book The D-Programming Language by Andrei Alexandrescu and I have tried to search the D-newsgroups for proper advice without success and I am humbly seeking enlightenment in the

Re: Learning D - first steps and best practices

2013-09-29 Thread Jonathan M Davis
On Sunday, September 29, 2013 09:13:26 Stefan Larsson wrote: Hello, I have started my journey to learn D after using C/C++ and Python for many years. I am studying the book The D-Programming Language by Andrei Alexandrescu and I have tried to search the D-newsgroups for proper advice

Re: Learning D - first steps and best practices

2013-09-29 Thread Michael
http://dlang.org/dstyle.html ))) DUB like other tools have a standard directory layout to accelerate a build process/configuration. DStyle and other guide lines are general recommendations only. If you have better style/case, you can describe and use it.

Phobos - pure, const, safe, nothrow

2013-09-29 Thread simendsjo
What is the status of adding these annotations to phobos? It's difficult to use these until phobos gets them. E.g. to! and format is not pure.

Re: Phobos - pure, const, safe, nothrow

2013-09-29 Thread monarch_dodra
On Sunday, 29 September 2013 at 09:00:56 UTC, simendsjo wrote: What is the status of adding these annotations to phobos? It's difficult to use these until phobos gets them. E.g. to! and format is not pure. Most of phobos is templated, meaning it relies on inference. These functions are

Re: Learning D - first steps and best practices

2013-09-29 Thread Stefan Larsson
On 2013-09-29 07:49:08 +, Jonathan M Davis said: On Sunday, September 29, 2013 09:13:26 Stefan Larsson wrote: Hello, I have started my journey to learn D after using C/C++ and Python for many years. I am studying the book The D-Programming Language by Andrei Alexandrescu and I have tried

Re: dmd -D == ouch!!

2013-09-29 Thread Joseph Rushton Wakeling
On 28/09/13 15:38, Damien wrote: From The D Programming Language by Andrei Alexandrescu: If you forget about --main, don't worry; the linker will fluently and baroquely remind you of that in its native language, encrypted Klingon. If you ever forget why we all love Andrei, a quick read of his

Re: Linking Trouble (Linux)

2013-09-29 Thread 1100110
https://xkcd.com/979/ Please. You are somebodies hero.

'pp' for D?

2013-09-29 Thread linkrope
I want to pretty-print the representation of a value of a generic type T. In Ruby, I would use 'pp': value = 'hello' pp value # prints hello - with quotes! value = 42 pp value # prints 42 Now, value.to!string eliminates the quotes, should value be of type string. As a

Re: Server is not active?

2013-09-29 Thread ollie
On Sun, 29 Sep 2013 03:47:27 +0200, wagtail wrote: When my server and client are on the same machine,these succeed. If I try communicating with other machine via global network,it do not work. IP of my server which you say above should set to server side? When you instantiate your

Struct literals bug ?

2013-09-29 Thread andrea9940
I think that I found a bug in the initialization of a struct. This program throws a.v.y != 0 but all assert should pass... (I'm using the latest dmd version available) Code: http://pastebin.com/VHQP8DaE

Re: Struct literals bug ?

2013-09-29 Thread John Colvin
On Sunday, 29 September 2013 at 16:36:22 UTC, andrea9940 wrote: I think that I found a bug in the initialization of a struct. This program throws a.v.y != 0 but all assert should pass... (I'm using the latest dmd version available) Code: http://pastebin.com/VHQP8DaE I'm not sure what the

Re: Struct literals bug ?

2013-09-29 Thread andrea9940
Thanks for the answer, I will use the aliases; however I just tried my code on codepad and surprising it worked without errors http://codepad.org/hp0YxIi7

Re: Struct literals bug ?

2013-09-29 Thread monarch_dodra
On Sunday, 29 September 2013 at 17:35:33 UTC, andrea9940 wrote: Thanks for the answer, I will use the aliases; however I just tried my code on codepad and surprising it worked without errors http://codepad.org/hp0YxIi7 I think there is a bug in there somewhere though: // struct V{

Re: 'pp' for D?

2013-09-29 Thread monarch_dodra
On Sunday, 29 September 2013 at 14:31:15 UTC, linkrope wrote: As a workaround, I put the value into an array to make use of the undocumented function formatElement: %(%s%).format([value]) That seems excessive. What happened to format(`%s`, s) or format(\%s\, s) or text('', s, '')?

Re: Struct literals bug ?

2013-09-29 Thread John Colvin
On Sunday, 29 September 2013 at 18:01:01 UTC, monarch_dodra wrote: On Sunday, 29 September 2013 at 17:35:33 UTC, andrea9940 wrote: Thanks for the answer, I will use the aliases; however I just tried my code on codepad and surprising it worked without errors http://codepad.org/hp0YxIi7 I

Re: ieeeFlags are not getting set.

2013-09-29 Thread Manfred Nowak
Damien wrote: is not a D bug I cannot reproduce your problem. Giving 10^38 and 10 as parameters the lol is output correctly. -manfred

Trouble creating bidirectional range

2013-09-29 Thread Martin Drasar
Hi, I have upgraded to dmd 2.063.2 and have some troubles making my custom bidirectional range work (it used to). In fact, even this code fails on assert and I am not really sure why... import std.range; struct MyRange(T) { private: T[] data; public: T front() @property { return

Re: Trouble creating bidirectional range

2013-09-29 Thread Andrej Mitrovic
On Sunday, 29 September 2013 at 20:37:13 UTC, Martin Drasar wrote: static assert(is(typeof(tmp.save) == MyRange!string)); You should call it like this: static assert(is(typeof(tmp.save()) == MyRange!string));

Re: Trouble creating bidirectional range

2013-09-29 Thread Andrej Mitrovic
On Sunday, 29 September 2013 at 20:42:20 UTC, Andrej Mitrovic wrote: On Sunday, 29 September 2013 at 20:37:13 UTC, Martin Drasar wrote: static assert(is(typeof(tmp.save) == MyRange!string)); You should call it like this: static assert(is(typeof(tmp.save()) == MyRange!string)); Btw, as for

Re: Trouble creating bidirectional range

2013-09-29 Thread Martin Drasar
On 29.9.2013 22:45, Andrej Mitrovic wrote: On Sunday, 29 September 2013 at 20:42:20 UTC, Andrej Mitrovic wrote: On Sunday, 29 September 2013 at 20:37:13 UTC, Martin Drasar wrote: static assert(is(typeof(tmp.save) == MyRange!string)); You should call it like this: static

Re: Trouble creating bidirectional range

2013-09-29 Thread Timon Gehr
On 09/29/2013 10:25 PM, Martin Drasar wrote: Hi, I have upgraded to dmd 2.063.2 and have some troubles making my custom bidirectional range work (it used to). In fact, even this code fails on assert and I am not really sure why... ... I get this when trying to compile: drasar@uriel:/tmp$ dmd

Re: 'pp' for D?

2013-09-29 Thread linkrope
On Sunday, 29 September 2013 at 18:14:03 UTC, monarch_dodra wrote: On Sunday, 29 September 2013 at 14:31:15 UTC, linkrope wrote: As a workaround, I put the value into an array to make use of the undocumented function formatElement: %(%s%).format([value]) That seems excessive. What