Re: WeakRefs for a CPP-D wrapper

2014-01-13 Thread MGW
Hi yes I think noticed in another thread that you were wrapping Qt with dynamic loading of the qt libs, interesting idea - does your code allow subclassing of the Qt classes and overriding the virtual methods? I'm taking a much more traditional approach, but there is method in my madness :-)

Re: When using Win32/x86 in a version block is that the compiler or OS?

2014-01-13 Thread Jacob Carlborg
On 2014-01-12 19:47, Gary Willoughby wrote: When using Win32/x86 in a version block, does that relate to the compiler or OS? for example: version(Win32) { // 32bit Windows or 32bit Compiler? } Microsoft 32-bit Windows systems version(X86) { // 32bit OS or 32bit Compiler? }

Re: What's the D way of application version numbers?

2014-01-13 Thread Russel Winder
On Sun, 2014-01-12 at 19:11 +, Adam D. Ruppe wrote: […] enum version = import(VERSION); // use it now like any other string in D Calling a string an enum seemed discordant, and version is sort of a reserved word (at least as far as Emacs D-Mode colorizing is concerned) so in the end I

Re: Value or Reference Semantics Trait

2014-01-13 Thread qznc
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array.

Re: Value or Reference Semantics Trait

2014-01-13 Thread John Colvin
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array.

Re: What's the D way of application version numbers?

2014-01-13 Thread Dicebot
On Monday, 13 January 2014 at 11:39:02 UTC, Russel Winder wrote: Calling a string an enum seemed discordant Slightly off-topic but I should mention that in D enums are not just enumerations but any compile-time constants and used idiomatically that way.

Re: What's the D way of application version numbers?

2014-01-13 Thread Meta
On Monday, 13 January 2014 at 11:39:02 UTC, Russel Winder wrote: immutable auto versionNumber = strip(import(VERSION)); The auto doesn't do anything in this case, as immutable is a storage class and hence implies auto. It might be better to write: static immutable versionNumber = ...

Re: Value or Reference Semantics Trait

2014-01-13 Thread Tobias Pankrath
On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote: Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array.

pure is as pure does with LLVM compiler

2014-01-13 Thread Ben Cumming
Hi There, I am playing around CTFE, and I get different compile time behavior with the reference compiler (both 64-bit Linux): DMD64 D Compiler v2.064 and the LLVM compiler: LDC - the LLVM D compiler (37ee99): based on DMD v2.063.2 and LLVM 3.3 The code snippet at the bottom of

Re: Value or Reference Semantics Trait

2014-01-13 Thread Orvid King
If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return type is T. On 1/13/14, Tobias Pankrath tob...@pankrath.net wrote: On

Re: Value or Reference Semantics Trait

2014-01-13 Thread Dicebot
On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread Dicebot
On Monday, 13 January 2014 at 13:37:05 UTC, Ben Cumming wrote: Hi There, I am playing around CTFE, and I get different compile time behavior with the reference compiler (both 64-bit Linux): DMD64 D Compiler v2.064 and the LLVM compiler: LDC - the LLVM D compiler (37ee99): based on

Re: Value or Reference Semantics Trait

2014-01-13 Thread anonymous
On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) if(typeof(T()) == T)` beware however that this will evaluate to true if T is a class with a static opCall who's return

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread Ben Cumming
On Monday, 13 January 2014 at 13:46:26 UTC, Dicebot wrote: This is the answer. Current LDC is still based on 2.063.2 version of frontend. There have been several tweaks in `std.conv` to make `to` more pure-friendly between those two releases. Thanks! I will recompile the latest version of

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread Dicebot
On Monday, 13 January 2014 at 14:18:49 UTC, Ben Cumming wrote: On Monday, 13 January 2014 at 13:46:26 UTC, Dicebot wrote: This is the answer. Current LDC is still based on 2.063.2 version of frontend. There have been several tweaks in `std.conv` to make `to` more pure-friendly between those

Re: Value or Reference Semantics Trait

2014-01-13 Thread Orvid King
On 1/13/14, anonymous anonym...@example.com wrote: On Monday, 13 January 2014 at 13:41:30 UTC, Orvid King wrote: If you just want to check if specifically it's a structure, you could always check `__traits(compiles, T()) if(typeof(T()) == T)` beware however that this will evaluate to true

Re: What's the D way of application version numbers?

2014-01-13 Thread Dejan Lekic
On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote: With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. For C++ a config file is constructed defining a macro that is then used in the rest of

Re: Question on static declaration

2014-01-13 Thread bearophile
Maxim Fomin: as well as more sophisticated nonsense. Issue is filed is bugzilla, so it will be fixed sooner or latter, current policy is to ignore it. See also: https://d.puremagic.com/issues/show_bug.cgi?id=3934 Bye, bearophile

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread Ben Cumming
On Monday, 13 January 2014 at 14:32:03 UTC, Dicebot wrote: I don't think 2.064 LDC has been released yet So I see, thanks.

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread David Nadlinger
On Monday, 13 January 2014 at 15:12:21 UTC, Ben Cumming wrote: On Monday, 13 January 2014 at 14:32:03 UTC, Dicebot wrote: I don't think 2.064 LDC has been released yet So I see, thanks. The merge-2.064 branch in Git is stable enough already for most purposes, so if you don't mind building

Re: Is continuously seeding a random number generator performance intensive?

2014-01-13 Thread marcpmichel
On Thursday, 2 January 2014 at 20:38:10 UTC, Jeroen Bollen wrote: Is it good to re-seed a generator for every coordinate, will this be performance intensive? Is there maybe way to easily implement Generator.at(uint x) in D?

Re: std.xml

2014-01-13 Thread Ola Fosheim Grøstad
Thanks Jacob and Dejan! I guess I can just build a generic DOM using one of those and replace the nodes I am interested with subclasses after the tree building process. I was thinking more of a library that allows me to say that a specific element (like svg) should use a specific subclass,

Re: What's the D way of application version numbers?

2014-01-13 Thread Russel Winder
On Mon, 2014-01-13 at 15:05 +, Dejan Lekic wrote: […] I simply define version in my main module (module which contains the main() function). I am planning to submit a DIP about something that is related to this. - I think we really need a way to specify version of package, and maybe

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-13 Thread Xavier Bigand
Le 12/01/2014 18:01, Benjamin Thaut a écrit : Am 12.01.2014 17:18, schrieb Xavier Bigand: Le 12/01/2014 11:16, Benjamin Thaut a écrit : Am 12.01.2014 00:47, schrieb Xavier Bigand: I didn't know this menu settings, but activate Access Violation don't change anything. It seems that your

Re: std.xml

2014-01-13 Thread Jacob Carlborg
On 2014-01-13 18:47, Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com wrote: Thanks Jacob and Dejan! I guess I can just build a generic DOM using one of those and replace the nodes I am interested with subclasses after the tree building process. I was thinking more of a library that

Re: What's the D way of application version numbers?

2014-01-13 Thread Meta
On Monday, 13 January 2014 at 19:18:17 UTC, Russel Winder wrote: On Mon, 2014-01-13 at 15:05 +, Dejan Lekic wrote: […] I simply define version in my main module (module which contains the main() function). I am planning to submit a DIP about something that is related to this. - I think we

Adding object files to dub build?

2014-01-13 Thread Jesse Phillips
I have a pre-built sqlite3 object file which I'd like to include as part of the linking for the final executable. I have been unable to find a way to do this with dub. I have attempted adding: sourceFiles: [csqlite3.obj], This doesn't work since it is added to the compile stage, and

Tyepof regex

2014-01-13 Thread Tiberiu Gal
what is the type returned by regex function? I want to store a regex member because I need to reuse it multiple times. Can this be done? class A { protected SomeTypeName regexPattern; void load() { string str; // obtain a regex pattern and store it as str. regexPattern

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-13 Thread Xavier Bigand
Le 13/01/2014 20:42, Xavier Bigand a écrit : Le 12/01/2014 18:01, Benjamin Thaut a écrit : Am 12.01.2014 17:18, schrieb Xavier Bigand: Le 12/01/2014 11:16, Benjamin Thaut a écrit : Am 12.01.2014 00:47, schrieb Xavier Bigand: I didn't know this menu settings, but activate Access Violation

Re: Tyepof regex

2014-01-13 Thread Brad Anderson
On Monday, 13 January 2014 at 20:53:55 UTC, Tiberiu Gal wrote: what is the type returned by regex function? I want to store a regex member because I need to reuse it multiple times. Can this be done? class A { protected SomeTypeName regexPattern; void load() { string str;

Re: Tyepof regex

2014-01-13 Thread Tiberiu Gal
On Monday, 13 January 2014 at 20:53:55 UTC, Tiberiu Gal wrote: what is the type returned by regex function? I want to store a regex member because I need to reuse it multiple times. Can this be done? class A { protected SomeTypeName regexPattern; void load() { string str;

Re: Tyepof regex

2014-01-13 Thread Tiberiu Gal
On Monday, 13 January 2014 at 20:59:28 UTC, Brad Anderson wrote: On Monday, 13 January 2014 at 20:53:55 UTC, Tiberiu Gal wrote: what is the type returned by regex function? I want to store a regex member because I need to reuse it multiple times. Can this be done? class A { protected

Re: Tyepof regex

2014-01-13 Thread Nicolas Sicard
On Monday, 13 January 2014 at 20:59:28 UTC, Brad Anderson wrote: There is also std.traits.ReturnType you can use for more complex types or voldemort types. Or: typeof(regex()) BTW, how does ReturnType handle overloads? -- Nicolas

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-13 Thread Benjamin Thaut
Am 13.01.2014 21:52, schrieb Xavier Bigand: glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,9) glBindBuffer(GL_ARRAY_BUFFER,10) glEnableVertexAttribArray(0) glVertexAttribPointer(0,3,GL_FLOAT,false,12,) glBindBuffer(GL_ARRAY_BUFFER,11) glEnableVertexAttribArray(1)

In-Place Ordering of Elements

2014-01-13 Thread Nordlöw
Does Phobos have some variadic algorithm to order l-value reference arguments in place? Something like int a=3; int b=2; int c=1; orderInPlace(a,b,c); // a is now 1 // b is now 2 // c is now 3 Also a functional variant, say `order(a, b, c)`, that returns a tuple

Why is string.front dchar?

2014-01-13 Thread TheFlyingFiddle
I'm curious, why is the .front property of narrow strings of type dchar? And not the underlying character type for the string.

Re: In-Place Ordering of Elements

2014-01-13 Thread anonymous
On Monday, 13 January 2014 at 22:28:23 UTC, Nordlöw wrote: Does Phobos have some variadic algorithm to order l-value reference arguments in place? Something like int a=3; int b=2; int c=1; orderInPlace(a,b,c); // a is now 1 // b is now 2 // c is now 3 import

Re: Why is string.front dchar?

2014-01-13 Thread bearophile
TheFlyingFiddle: I'm curious, why is the .front property of narrow strings of type dchar? And not the underlying character type for the string. There was a long discussion on this. It was chosen this way to allow most range-based algorithms to work correctly on UTF8 and UTF16 strings. In

Re: In-Place Ordering of Elements

2014-01-13 Thread bearophile
anonymous: static ref int deref(int* p) {return *p;} sort(only(a, b, c).map!deref); Despite some holes, std.algorithm and std.range are quite powerful. Sometimes using them feels like playing a puzzle game :-) Bye, bearophile

Re: Regarding std.range.indexed

2014-01-13 Thread bearophile
Jesse Phillips: I thought it was to provide an index number during a foreach iteration. That's the enumerate() range, that is still missing in Phobos. If you have an randomAccess range with assignable elements, why use indexed? But source is immutable, so its elements aren't assignable.

Re: Why is string.front dchar?

2014-01-13 Thread Jonathan M Davis
On Monday, January 13, 2014 23:10:03 TheFlyingFiddle wrote: I'm curious, why is the .front property of narrow strings of type dchar? And not the underlying character type for the string. It's to promote the correct handling of Unicode. A couple of related questions and answers:

Re: Why is string.front dchar?

2014-01-13 Thread Meta
On Tuesday, 14 January 2014 at 03:01:53 UTC, Jonathan M Davis wrote: On Monday, January 13, 2014 23:10:03 TheFlyingFiddle wrote: I'm curious, why is the .front property of narrow strings of type dchar? And not the underlying character type for the string. It's to promote the correct handling

Shared library string safety?

2014-01-13 Thread Mineko
Alright, so I FINALLY got shared libraries somewhat working through my program, however I have some issues transferring data between the shared library and the main program, the problem is between https://github.com/MinekoRox/Breaker-Engine/blob/master/src/breaker/utility/settings.d and

Re: Shared library string safety?

2014-01-13 Thread evilrat
On Tuesday, 14 January 2014 at 05:50:37 UTC, Mineko wrote: Alright, so I FINALLY got shared libraries somewhat working through my program, however I have some issues transferring data between the shared library and the main program, the problem is between

Re: Shared library string safety?

2014-01-13 Thread Mineko
Sorry for the double post, I should be more specific. .dup worked, I don't know how to have the GC proxy for shared libs though.

Re: Shared library string safety?

2014-01-13 Thread Mineko
On Tuesday, 14 January 2014 at 06:40:52 UTC, evilrat wrote: On Tuesday, 14 January 2014 at 05:50:37 UTC, Mineko wrote: Alright, so I FINALLY got shared libraries somewhat working through my program, however I have some issues transferring data between the shared library and the main program,

Re: Shared library string safety?

2014-01-13 Thread evilrat
On Tuesday, 14 January 2014 at 06:48:48 UTC, Mineko wrote: Sorry for the double post, I should be more specific. .dup worked, I don't know how to have the GC proxy for shared libs though. the reason string.dup worked is due to GC on app side, right after the moment your lib receive the

Re: Shared library string safety?

2014-01-13 Thread Mineko
On Tuesday, 14 January 2014 at 07:23:52 UTC, evilrat wrote: the reason string.dup worked is due to GC on app side, right after the moment your lib receive the original string it is may be marked by GC for collection, so you need to save a copy on lib side. but using the proxies it should