Re: Starting D with a project in mind.

2013-10-11 Thread Andrew
As Adam already said D on Pi is adventurous. For MongoDB and web stuff, you should look into Vibe.d [0]. For parsing I would suggest Pegged [1]. Welcome to D and Happy Hacking! :) [0] http://vibed.org/ [1] https://github.com/PhilippeSigaud/Pegged Thanks both. Well after several hours of

Re: How to check for instantiation of specific template?

2013-10-11 Thread Jacob Carlborg
On 2013-10-10 19:23, H. S. Teoh wrote: I have a template used for storing compile-time values: template Def(int x, string y) { alias impl = TypeTuple!(x,y); } How do I define a template isDef that, given some template alias A, evaluates to true if A is some insta

Re: std.process spawnShell/pipeShell dont capture output of the shell

2013-10-11 Thread Colin Grogan
On Thursday, 10 October 2013 at 01:24:03 UTC, Jesse Phillips wrote: On Wednesday, 9 October 2013 at 14:54:32 UTC, Colin Grogan wrote: is blocking. However, its not meant to be blocking is it not? That new /bin/bash process is meant to run in parallel to the main process? I'm not sure exactly

Re: Traits

2013-10-11 Thread Jacob Carlborg
On 2013-10-11 07:49, luminousone wrote: import std.traits; bool ChildInheritsFromParent( parent, child )( ) { foreach ( k, t; BaseClassesTuple!child ) { if( typeid(t) == typeid(parent) ) return true; } return false; } That will perform a runtime check and

Re: Traits

2013-10-11 Thread luminousone
On Friday, 11 October 2013 at 09:37:33 UTC, Jacob Carlborg wrote: On 2013-10-11 07:49, luminousone wrote: import std.traits; bool ChildInheritsFromParent( parent, child )( ) { foreach ( k, t; BaseClassesTuple!child ) { if( typeid(t) == typeid(parent) ) return true;

Re: fast floor

2013-10-11 Thread Sönke Ludwig
Am 11.10.2013 00:27, schrieb Spacen Jasset: Hello, I am after a fast floor function; In fact a fast truncation and conversion to integer. I see that std.math takes a real, and that std.c.math takes a double. Is there a quicker function, and what might cast(int)1.5f do? Regards, Spacen. For

Re: How to check for instantiation of specific template?

2013-10-11 Thread Dicebot
This is actually a very interesting question. Usual approach is to use pattern matching on types but template instance symbol is not a type on its own, it is just a symbol. (with typeof == void) My second guess was to check __traits(identifier, AliasParam) but it looks like for aliased insta

Re: Traits

2013-10-11 Thread Jacob Carlborg
On 2013-10-11 11:49, luminousone wrote: Is is just the typeid call that makes it unable to be ran at compile time or is their something else wrong in their?, Would a string compare with type.classInfo.name fix that, or is their not a tool yet in place for that? Hmm, it may actually be possibl

Re: Traits

2013-10-11 Thread Gary Willoughby
On Friday, 11 October 2013 at 05:49:38 UTC, luminousone wrote: On Friday, 11 October 2013 at 04:13:55 UTC, Agustin wrote: I have a function that needs to check if the template provided inherit a class. For example: public void function(T, A...)(auto ref A values) { // static assert(IsBaseOf(

Re: Traits

2013-10-11 Thread Agustin
On Friday, 11 October 2013 at 04:35:38 UTC, Ali Çehreli wrote: On 10/10/2013 09:13 PM, Agustin wrote: > I have a function that needs to check if the template provided inherit a > class. > > For example: > > public void function(T, A...)(auto ref A values) function happens to be a keyword. :) >

Re: Call a function with a function pointer

2013-10-11 Thread Artur Skawina
On 10/10/13 20:54, Dicebot wrote: > On Thursday, 10 October 2013 at 17:47:54 UTC, Namespace wrote: >> >> import std.stdio; >> >> void foo1(void function(void*) fp) { } >> void foo2(void function(int) fp) { } >> void foo3(void*) { } >> >> void main() >> { >> foo1((void* ptr) => ( assert(ptr

Re: Call a function with a function pointer

2013-10-11 Thread Dicebot
On Friday, 11 October 2013 at 15:55:17 UTC, Artur Skawina wrote: It's probably not just "incompetence" (the compiler is able to figure this out in other contexts), but a deliberate choice. Having function types depend on their bodies would not be a good idea. Eg int c; auto f() {

Linker error: Symbol Undefined

2013-10-11 Thread Namespace
Hey, I'm curious about this linker error: OPTLINK (R) for Win32 Release 8.00.13 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html bar.obj(bar) Error 42: Symbol Undefined _D3foo1A6__dtorMFZv --- errorlevel 1 foo.d: debug import std.stdio

Re: Traits

2013-10-11 Thread Jonathan M Davis
On Friday, October 11, 2013 15:34:28 Jacob Carlborg wrote: > On 2013-10-11 11:49, luminousone wrote: > > Is is just the typeid call that makes it unable to be ran at compile > > time or is their something else wrong in their?, > > > > Would a string compare with type.classInfo.name fix that, or is

Re: Traits

2013-10-11 Thread luminousone
On Friday, 11 October 2013 at 14:09:09 UTC, Gary Willoughby wrote: On Friday, 11 October 2013 at 05:49:38 UTC, luminousone wrote: On Friday, 11 October 2013 at 04:13:55 UTC, Agustin wrote: I have a function that needs to check if the template provided inherit a class. For example: public voi

Re: Traits

2013-10-11 Thread Jonathan M Davis
On Friday, October 11, 2013 21:19:29 luminousone wrote: > Using casts that way won't always be correct, it would be better > to use reflection in some way if possible. The only reason that the casts wouldn't be correct would be if the class overrode opCast for the type that you're casting to or h

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
It's annoying and I don't get it. What is the problem of Optlink? I tried version(unittest) instead of debug. It works then with -debug, but if you compile with -unittest you get the same error.

Re: fast floor

2013-10-11 Thread Spacen Jasset
On 11/10/2013 07:25, monarch_dodra wrote:> On Thursday, 10 October 2013 at 22:27:14 UTC, Spacen Jasset wrote: >> Hello, >> >> I am after a fast floor function; In fact a fast truncation and >> conversion to integer. I see that std.math takes a real, and that >> std.c.math takes a double. >> >> Is

Re: Starting D with a project in mind.

2013-10-11 Thread Stefan Frijters
On Friday, 11 October 2013 at 07:09:17 UTC, Andrew wrote: As Adam already said D on Pi is adventurous. For MongoDB and web stuff, you should look into Vibe.d [0]. For parsing I would suggest Pegged [1]. Welcome to D and Happy Hacking! :) [0] http://vibed.org/ [1] https://github.com/Philip

Re: Traits

2013-10-11 Thread Agustin
On Friday, 11 October 2013 at 19:19:31 UTC, luminousone wrote: On Friday, 11 October 2013 at 14:09:09 UTC, Gary Willoughby wrote: On Friday, 11 October 2013 at 05:49:38 UTC, luminousone wrote: On Friday, 11 October 2013 at 04:13:55 UTC, Agustin wrote: I have a function that needs to check if th

Re: Traits

2013-10-11 Thread luminousone
On Friday, 11 October 2013 at 19:54:39 UTC, Jonathan M Davis wrote: On Friday, October 11, 2013 21:19:29 luminousone wrote: Using casts that way won't always be correct, it would be better to use reflection in some way if possible. The only reason that the casts wouldn't be correct would be i

Re: Linker error: Symbol Undefined

2013-10-11 Thread Brad Roberts
It's due to having the destructor versioned out when building foo and visible when building bar. When brought together, you've created an incompatible whole. There's no destructor actually included in foo's .o file that you told it it could expect to find. There's no bug in the compiler or lin

Re: Traits

2013-10-11 Thread Jonathan M Davis
On Friday, October 11, 2013 23:06:53 luminousone wrote: > On Friday, 11 October 2013 at 19:54:39 UTC, Jonathan M Davis > > wrote: > > On Friday, October 11, 2013 21:19:29 luminousone wrote: > >> Using casts that way won't always be correct, it would be > >> better > >> to use reflection in some wa

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
Ok, that is what I wanted to hear.

Re: Linker error: Symbol Undefined

2013-10-11 Thread Namespace
On Friday, 11 October 2013 at 21:16:38 UTC, Brad Roberts wrote: It's due to having the destructor versioned out when building foo and visible when building bar. When brought together, you've created an incompatible whole. There's no destructor actually included in foo's .o file that you told i

Re: My design need friends

2013-10-11 Thread Namespace
On Sunday, 6 October 2013 at 13:11:02 UTC, Andrej Mitrovic wrote: On 10/6/13, Namespace wrote: And I should write a blog post about your and my solution. :) Let me try to hack on __PRETTY_FUNCTION__ first and I'll post a working example here soon. Is there something new?

Re: Traits

2013-10-11 Thread luminousone
On Friday, 11 October 2013 at 21:49:50 UTC, Jonathan M Davis wrote: On Friday, October 11, 2013 23:06:53 luminousone wrote: On Friday, 11 October 2013 at 19:54:39 UTC, Jonathan M Davis wrote: > On Friday, October 11, 2013 21:19:29 luminousone wrote: >> Using casts that way won't always be corre

Re: My design need friends

2013-10-11 Thread Namespace
On Friday, 11 October 2013 at 22:39:18 UTC, Namespace wrote: On Sunday, 6 October 2013 at 13:11:02 UTC, Andrej Mitrovic wrote: On 10/6/13, Namespace wrote: And I should write a blog post about your and my solution. :) Let me try to hack on __PRETTY_FUNCTION__ first and I'll post a working ex

Re: Can't inherit a class and multiple interfaces.

2013-10-11 Thread Agustin
On Saturday, 12 October 2013 at 01:35:48 UTC, Agustin wrote: Like the the title says, i cannot inherit a class and have interfaces. class A { } interface B { } class C : A, B -> Error { } I know that D doesn't support multiple classes, but that means i cannot mix a class and an interface?

Can't inherit a class and multiple interfaces.

2013-10-11 Thread Agustin
Like the the title says, i cannot inherit a class and have interfaces. class A { } interface B { } class C : A, B -> Error { } I know that D doesn't support multiple classes, but that means i cannot mix a class and an interface?

Re: Traits

2013-10-11 Thread Jonathan M Davis
On Saturday, October 12, 2013 00:54:48 luminousone wrote: > The inability to handle null is pretty big, specially considering > that at not point is the class instance itself cared about!, No. It's expected. When you are casting to a particular object to test whether the object is of that type, y

Re: Traits

2013-10-11 Thread Jonathan M Davis
On Friday, October 11, 2013 22:31:25 Jonathan M Davis wrote: > On Saturday, October 12, 2013 00:54:48 luminousone wrote: > > The inability to handle null is pretty big, specially considering > > that at not point is the class instance itself cared about!, > > No. It's expected. When you are castin