Re: Matter of style, and cast()

2013-08-05 Thread Bosak
On Monday, 5 August 2013 at 13:01:19 UTC, bearophile wrote: Some small style rules for D user code: 1) All variables and functions arguments should be immutable/const (or enum), unless they have to mutate (or there is some other problem in Phobos, in the D type system, or in your other

Re: Matter of style, and cast()

2013-08-05 Thread Bosak
I made a markdown gist for the above module import tips: https://gist.github.com/nikibobi/6156492

Re: Hello D-world!, imports South African D-naughts

2013-08-03 Thread Bosak
On Saturday, 3 August 2013 at 09:02:32 UTC, Andre Artus wrote: On Saturday, 3 August 2013 at 06:51:40 UTC, evilrat wrote: On Saturday, 3 August 2013 at 05:24:11 UTC, Andre Artus wrote: On Saturday, 3 August 2013 at 04:38:13 UTC, Andre Artus wrote: Hello D-world! My name is Andre Artus, and

Re: Hello D-world!, imports South African D-naughts

2013-08-03 Thread Bosak
The D Programming Language is kind of old and out of date for the current version of D. There aren't many books for D so you have not much choice. Attributes can be declared with 3 different syntaxes. For example one could write: //--1-- /*Explicitly state attribute before every declaration*/

Re: Debugging templates!

2013-08-03 Thread Bosak
On Saturday, 3 August 2013 at 14:35:52 UTC, JS wrote: On Saturday, 3 August 2013 at 14:04:10 UTC, JS wrote: There has to be a better way?!?!?!?! Of course, I mean string mixin's using template.. and the statement was to ask people how they went about it... I usually write unittests that

How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is there a way to do that with only one template argument. And then use it like: string text = null; mixin

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is there a way to do that with only one template argument

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 11:48:32 UTC, Andrej Mitrovic wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 12:10:00 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:52:32 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 12:47:51 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 12:17:12 UTC, Bosak wrote: On Friday, 2 August 2013 at 12:10:00 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:52:32 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I