Re: Json

2017-11-18 Thread bauss via Digitalmars-d-learn
On Friday, 17 November 2017 at 19:12:04 UTC, Jonathan M Davis wrote: On Friday, November 17, 2017 19:02:12 Mafi via Digitalmars-d-learn wrote: [...] I've typically used http://code.dlang.org/packages/std_data_json which comes from vibe.d and was a candidate for replacing std.json - though

Re: Call thread_attachThis() from your D shared library

2017-11-18 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 18 November 2017 at 00:23:31 UTC, Ali Çehreli wrote: We had an issue today calling a D shared library from our Java code where we were getting segfaults during GC collection cycles. Of course we were being careful and calling Runtime.initialize() inside our initialization

DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Dennis via Digitalmars-d-learn
I'm trying to set up a game window with Derelict glfw and opengl. When I perform a default (debug) build, it correctly shows a window, but when I do this: dub run "--build=release" Then I get this: object.Error@(0): Access Violation 0x00443BCF 0x00425164 0x00418545 0x00418874

Re: DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 November 2017 at 12:36:36 UTC, Dennis wrote: I'm trying to set up a game window with Derelict glfw and opengl. When I perform a default (debug) build, it correctly shows a window, but when I do this: dub run "--build=release" Then I get this: object.Error@(0): Access

Re: Lambda cannot access frame of function

2017-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/2017 06:22 AM, kerdemdemir wrote: //DMD64 D Compiler 2.072.2 import std.stdio; bool foo(  bool function( double ) controlFoo ) {     return controlFoo(5.0); } void foo2( double val ) {     writeln  ( foo( a => a > val ) ); } void main() {     foo2(20);     writeln("Hello,

Re: Lambda cannot access frame of function

2017-11-18 Thread kerdemdemir via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:30:29 UTC, Adam D. Ruppe wrote: On Saturday, 18 November 2017 at 14:22:19 UTC, kerdemdemir wrote: bool foo( bool function( double ) controlFoo ) Change that `function` to `delegate` and it should work. Function pointers aren't allowed to access other

Re: DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:15:21 UTC, Mike Parker wrote: The proper place to report this sort of issue is at the DerelictGL3 issues page [1]. You'll also want to include some minimal, reproducible sample code. [1] https://github.com/DerelictOrg/DerelictGL3/issues

Lambda cannot access frame of function

2017-11-18 Thread kerdemdemir via Digitalmars-d-learn
//DMD64 D Compiler 2.072.2 import std.stdio; bool foo( bool function( double ) controlFoo ) { return controlFoo(5.0); } void foo2( double val ) { writeln ( foo( a => a > val ) ); } void main() { foo2(20); writeln("Hello, World!"); } Does not compile and gives this errors:

Re: Json

2017-11-18 Thread kerdemdemir via Digitalmars-d-learn
I am using vibe.d's json(http://vibed.org/api/vibe.data.json/) module without a problem and really happy with it. There are also some examples(https://github.com/vibe-d/vibe.d/tree/master/examples/json). If you are using "dub" package manager it is also very easy to integrate vibe.d.

Re: Lambda cannot access frame of function

2017-11-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:22:19 UTC, kerdemdemir wrote: bool foo( bool function( double ) controlFoo ) Change that `function` to `delegate` and it should work. Function pointers aren't allowed to access other locals, but delegates are.

Re: User defined type and foreach

2017-11-18 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 17, 2017 at 02:50:59AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: [...] > Personally, I'm inclined to think that we should never have had save > and should have required that reference type ranges which are forward > ranges be wrapped in a struct where copying it does the

Re: DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Dennis via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:15:21 UTC, Mike Parker wrote: The proper place to report this sort of issue is at the DerelictGL3 issues page [1]. You'll also want to include some minimal, reproducible sample code. Okay, I've made an issue:

Re: GtkD help

2017-11-18 Thread Ivan Trombley via Digitalmars-d-learn
Any information about using gio.Settings would be really appreciated too.

GtkD help

2017-11-18 Thread Ivan Trombley via Digitalmars-d-learn
I have this small application for viewing select log data from a certain game that I originally wrote in C++/Qt. For various reasons, I decided to rewrite this app in D using gtk-d. First, I have to say that the documentation for gtk-d is atrocious! However, I managed to cobble together enough

Re: @nogc deduction for templated functions

2017-11-18 Thread David Zhang via Digitalmars-d-learn
Huh, I think I did something weird. It compiles now, and I don't know why. Thanks for your answers.

Re: Call thread_attachThis() from your D shared library

2017-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/2017 03:45 AM, Guillaume Piolat wrote: > I highly advise to attach incoming threads _and detach them when they > exit the callback_. Indeed when they have exited the callback no need to > scan their stack. > > If you don't do this and the thread dies outside your library, then your >

@nogc deduction for templated functions

2017-11-18 Thread David Zhang via Digitalmars-d-learn
Hi, Is there a way for a templated function to deduce or apply the @safe/@nogc attributes automaticaly? I feel like I remember dmd doing so at one point, but it doesn't appear to work anymore. In particular, I need to call a function belonging to a templated type, but do not know what

Re: @nogc deduction for templated functions

2017-11-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 18, 2017 17:28:14 David Zhang via Digitalmars-d-learn wrote: > Hi, > > Is there a way for a templated function to deduce or apply the > @safe/@nogc attributes automaticaly? I feel like I remember dmd > doing so at one point, but it doesn't appear to work anymore. In >

Re: @nogc deduction for templated functions

2017-11-18 Thread Eugene Wissner via Digitalmars-d-learn
On Saturday, 18 November 2017 at 17:28:14 UTC, David Zhang wrote: Hi, Is there a way for a templated function to deduce or apply the @safe/@nogc attributes automaticaly? I feel like I remember dmd doing so at one point, but it doesn't appear to work anymore. In particular, I need to call a