Multilingual DDoc

2014-03-04 Thread Uranuz
I'm novice in D documentation system. I haven't done any comments in DDoc style but want to. My problem is that I want to share my library with community but in the same time I need to make it understandable for programmers in my team who speak Russian but not so good in English. For now I

Re: Multilingual DDoc

2014-03-04 Thread Brian Schott
On Tuesday, 4 March 2014 at 08:21:27 UTC, Uranuz wrote: I'm novice in D documentation system. I haven't done any comments in DDoc style but want to. My problem is that I want to share my library with community but in the same time I need to make it understandable for programmers in my team who

Re: adding static return?

2014-03-04 Thread Nicolas Sicard
On Monday, 3 March 2014 at 23:27:42 UTC, Xavier Bigand wrote: I thought it could be nice to have a static return. My Idea is to remove unnecessary bracket encapsulation made with some static if statements. It will works like this : module xxx.opengl; import buildSettings; // contains some

Re: Issus with DMD 2.065

2014-03-04 Thread John Colvin
On Tuesday, 4 March 2014 at 00:41:09 UTC, Hertz wrote: Ever since I installed the latest DMD 2.065 I cant seem to compile and run .d files anymore. I'm installing dmd using the .deb file on Ubuntu. When it is installed and I try to compile a .d file the console gives me this. cannot find

Re: Nobody understands templates?

2014-03-04 Thread Chris
On Monday, 3 March 2014 at 22:50:18 UTC, Frustrated wrote: On Monday, 3 March 2014 at 18:46:24 UTC, Chris wrote: I think the problem is not that people don't understand templates in the sense that they are abstractions. The question is whether there are loads and loads of use cases for

Re: Nobody understands templates?

2014-03-04 Thread H. S. Teoh
On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote: [...] Maybe that's why it is so hard to see the benefits of templates, because many cases (of abstraction) are already covered by OOP. I like templates, but I'm not sure if they are as useful as D's ranges. Ranges and component programming

Re: getTid wrapper

2014-03-04 Thread Stanislav Blinov
On Tuesday, 4 March 2014 at 15:52:37 UTC, Timothee Cour wrote: quoting from there: The type of thisTid is Tid, but its value has no significance for the program. Further, both threads report it to be surprisingly at the same address: Owner : Tid(std.concurrency.MessageBox), address: 809C360

Re: getTid wrapper

2014-03-04 Thread Ali Çehreli
On 03/04/2014 08:27 AM, Stanislav Blinov wrote: Perhaps that book section is indeed not clear enough. thisTid actually gets an address of 'thisTid', which is (at least in current implementation) a function. Makes sense. I remember thisTid being a module-level variable at the time I wrote

Re: Nobody understands templates?

2014-03-04 Thread Chris
On Tuesday, 4 March 2014 at 15:52:37 UTC, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote: [...] Maybe that's why it is so hard to see the benefits of templates, because many cases (of abstraction) are already covered by OOP. I like templates, but I'm not sure if they

Re: getTid wrapper

2014-03-04 Thread Timothee Cour
On Tue, Mar 4, 2014 at 10:09 AM, Timothee Cour thelastmamm...@gmail.comwrote: Thanks, that works does it make sense to add a function to do that? as it stands there are 2 separate ways, cast(void*)Thread.getThis and cast(void*)getTid, so having a function would make it the preferred way.

Re: Nobody understands templates?

2014-03-04 Thread H. S. Teoh
On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote: On Tuesday, 4 March 2014 at 15:52:37 UTC, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 10:32:52AM +, Chris wrote: [...] Maybe that's why it is so hard to see the benefits of templates, because many cases (of abstraction) are already

Re: Nobody understands templates?

2014-03-04 Thread Russel Winder
On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote: […] True, true. The fact that the compiler can check for the right types is great. Btw, the quote you have in this post: Never ascribe to malice that which is adequately

Re: Nobody understands templates?

2014-03-04 Thread Jesse Phillips
On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote: I just discovered by trial and error that I could use 'mixin' in Templates (as opposed to Template Mixins), and when you know that it seems likely that you can accomplish lots of stuff you couldn't before. This was asked about

Re: Nobody understands templates?

2014-03-04 Thread H. S. Teoh
On Tue, Mar 04, 2014 at 07:23:49PM +, Jesse Phillips wrote: On Sunday, 2 March 2014 at 11:47:39 UTC, Steve Teale wrote: I just discovered by trial and error that I could use 'mixin' in Templates (as opposed to Template Mixins), and when you know that it seems likely that you can accomplish

Re: Nobody understands templates?

2014-03-04 Thread Chris
On Tuesday, 4 March 2014 at 19:18:28 UTC, Russel Winder wrote: On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote: […] True, true. The fact that the compiler can check for the right types is great. Btw, the quote you have in this

Re: Nobody understands templates?

2014-03-04 Thread H. S. Teoh
On Tue, Mar 04, 2014 at 07:18:17PM +, Russel Winder wrote: On Tue, 2014-03-04 at 10:27 -0800, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote: [...] Btw, the quote you have in this post: Never ascribe to malice that which is adequately explained by

Re: Mutexes and locking

2014-03-04 Thread Sean Kelly
For what it's worth, you can also do: auto m = new Mutex; sycnchronized (m) { // do stuff } The synchronized block will call lock on enter and unlock on exit, even as a result of a throw.

Re: Nobody understands templates?

2014-03-04 Thread Sean Kelly
On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote: All the D aficionados seem to wet their pants over meta-programming, but I struggle to find a place to use it. IIRC, I used it in a couple of places when I was trying to write library stuff for MySQL, but in my current project, I

ctor for shared and immutable structs

2014-03-04 Thread Oleg B
why this code get errors? [code] /* 1 */struct PData /* 2 */{ /* 3 */immutable(ubyte)[] data; // ??? /* 4 */pure this(T)( in T val ) { } /* 5 */} /* 6 */ /* 7 */unittest /* 8 */{ /* 9 */immutable(ubyte)[] data_a = [1,2,3]; /* 10 */ubyte[] data_b = [1,2,3]; /* 11 */

Re: Nobody understands templates?

2014-03-04 Thread Nick Sabalausky
On 3/1/2014 1:00 PM, Steve Teale wrote: I have already dealt with the yada-yada cases by old-fashioned OOP. As I see it, a big part of the benefit of templates is that they can help you avoid a lot of the downsides of OOP: - OO Boilerplate. - Multiple dispatch is ridiculously messy, having

Re: Nobody understands templates?

2014-03-04 Thread bearophile
Nick Sabalausky: - Lumping all data/functionality for a single object instance into the same physical chunk of memory causes problems for parallelization. And that's increasingly problematic on modern processors which work best when operating as streaming-data processors. (See

Re: Nobody understands templates?

2014-03-04 Thread Nick Sabalausky
On 3/4/2014 7:42 PM, bearophile wrote: Nick Sabalausky: - Lumping all data/functionality for a single object instance into the same physical chunk of memory causes problems for parallelization. And that's increasingly problematic on modern processors which work best when operating as

Re: Nobody understands templates?

2014-03-04 Thread bearophile
Nick Sabalausky: But, I admit, I have wondered if a language could aid the creation/usage of entity systems with some special language features. I have seen that a good way to learn lazyness and purity is to try to write some Haskell code. Then you can use the same ideas in other

Re: Nobody understands templates?

2014-03-04 Thread Nick Sabalausky
On 3/3/2014 5:35 PM, Chris wrote: Maybe I'm a bit too philosophical about this. But consider the following (made up) case: struct MyTemp(T) { // ... T add(T a, T b) { if (a is string b is string) { return a~b; // or return a~+~b; or whatever } else

Re: Nobody understands templates?

2014-03-04 Thread Nick Sabalausky
On 3/4/2014 1:27 PM, H. S. Teoh wrote: On Tue, Mar 04, 2014 at 06:19:38PM +, Chris wrote: Btw, the quote you have in this post: Never ascribe to malice that which is adequately explained by incompetence. -- Napoleon Bonaparte I'm surprised that Napoleon would say something like this.

Re: Nobody understands templates?

2014-03-04 Thread Nick Sabalausky
On 3/4/2014 9:00 PM, bearophile wrote: Nick Sabalausky: But, I admit, I have wondered if a language could aid the creation/usage of entity systems with some special language features. I have seen that a good way to learn lazyness and purity is to try to write some Haskell code. Then you can