Re: Relative lflag paths in dub on Windows

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 00:22:56 UTC, Mike Parker wrote: On Wednesday, 28 June 2017 at 00:16:23 UTC, Mike Parker wrote: On Tuesday, 27 June 2017 at 19:07:49 UTC, You have to specify the appropriate linker option, e.g. -L-option. For gcc, that happens to -L, so you get -L-L. For optlink

dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
I am behind a corporate firewall at work so I have to manually install dub packages. This requires setting the version manually, otherwise master is inferred. This was working great until I had ended a dub run command early. Now dub seems to have forgotten that the versions are in there. It's

Re: dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 19:54:01 UTC, jmh530 wrote: [snip] Does not seem to be a problem for another project using dub with dmd and similar dependencies...

Re: dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 20:18:20 UTC, jmh530 wrote: On Wednesday, 28 June 2017 at 19:54:01 UTC, jmh530 wrote: [snip] Does not seem to be a problem for another project using dub with dmd and similar dependencies... After spending some time looking through the dub issues, I found that

Force usage of double (instead of higher precision)

2017-06-28 Thread Simon Bürger via Digitalmars-d-learn
According to the standard (http://dlang.org/spec/float.html), the compiler is allowed to compute any floating-point statement in a higher precision than specified. Is there a way to deactivate this behaviour? Context (reason why I need this): I am building a "double double" type, which

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: (If you are interested in the "double double" type, take a look here: https://github.com/BrianSwift/MetalQD which includes a double-double and even quad-double implementation in C/C++/Fortran) Nice work can you re or dual

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: As for your problems they can be worked around. by assigning every temporary to a variable. Which will enforce the discarding of precision. Sorry for the misinformation! I was using the newCTFE fork which fixes this. Indeed you'll

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: I am currently using LDC on 64-bit-Linux if that is relevant. It is, as LDC on Windows/MSVC would use 64-bit compile-time reals. ;) Changing it to double on other platforms is trivial if you compile LDC yourself. You'll want

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Moritz Maxeiner via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon as you use DerelictUtil for example. I thought I had (implicitly): B needs to be `@disable finalize`.

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Moritz Maxeiner via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 09:22:07 UTC, Guillaume Piolat wrote: Deterministic destruction is a _solved_ problem in C++, and a number of users to convert are now coming from C++. It is also in D, as long as you don't use the GC (which is inherently non-deterministic). 3. Suggest a

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 02:13:10 UTC, Jonathan M Davis wrote: There are definitely cases where finalizers make sense. Case in point: if you have a socket class, it makes perfect sense for it to have a finalizer. Yes, it's better to close it manually, but it will work just fine for the GC

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: On Wednesday, 28 June 2017 at 02:13:10 UTC, Jonathan M Davis wrote: There are definitely cases where finalizers make sense. Case in point: if you have a socket class, it makes perfect sense for it to have a finalizer. Yes,

Re: Overloading funtion templates.

2017-06-28 Thread vit via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 11:49:57 UTC, Balagopal Komarath wrote: Shouldn't the compiler be able to resolve foo!g(3) to the first template foo? import std.stdio; import std.algorithm; import std.range; auto foo(F, T)(T x) { return x.foo(F); } auto foo(F, T)(T x, F f) { return

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon as you use DerelictUtil for example. What's the issue with DerelictUtil?

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 11:21:07 UTC, Moritz Maxeiner wrote: On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon as you use DerelictUtil for example. I thought I had

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 11:34:17 UTC, Moritz Maxeiner wrote: Requirement: Do not allocate using the GC Option 1) Use structs with `@disable this`, `@disable this(this)`, and a destructor that checks whether the resource reference is != invalid resource reference before trying to

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Moritz Maxeiner via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 12:33:24 UTC, Guillaume Piolat wrote: On Wednesday, 28 June 2017 at 11:34:17 UTC, Moritz Maxeiner wrote: Requirement: Do not allocate using the GC Option 1) Use structs with `@disable this`, `@disable this(this)`, and a destructor that checks whether the resource

Overloading funtion templates.

2017-06-28 Thread Balagopal Komarath via Digitalmars-d-learn
Shouldn't the compiler be able to resolve foo!g(3) to the first template foo? import std.stdio; import std.algorithm; import std.range; auto foo(F, T)(T x) { return x.foo(F); } auto foo(F, T)(T x, F f) { return f(x); } int g(int x) { return x; } void main() { foo(3, ); // 2nd

Diet template is crush

2017-06-28 Thread Suliman via Digitalmars-d-learn
I can't understand why follow code is crushing: string error = "503 Server error!"; int error_code = 503; res.render!("error.dt", error, error_code); on res string (last in code above) I am getting error: CoreTaskFiber was terminated unexpectedly: Access Violation error.dt

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Moritz Maxeiner via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 12:28:28 UTC, Guillaume Piolat wrote: On Wednesday, 28 June 2017 at 11:21:07 UTC, Moritz Maxeiner wrote: On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon

Re: Diet template is crush

2017-06-28 Thread Suliman via Digitalmars-d-learn
It's look like issue in another part of code...

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 13:02:04 UTC, Mike Parker wrote: On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon as you use DerelictUtil for example. What's the issue with

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 13:19:37 UTC, Guillaume Piolat wrote: https://forum.dlang.org/post/pmulowxpikjjffkrs...@forum.dlang.org Not an issue with DerelictUtil, an issue with the strategy of closing resources in GC with this case. Derelict loaders work-around this by not unloading

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread John Burton via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 09:54:19 UTC, John Burton wrote: I'm coming from a C++ background so I'm not too used to garbage collection and it's implications. I have a function that creates a std.socket.Socket using new and connects to a tcp server, and writes some stuff to it. I then

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Dsby via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 09:54:19 UTC, John Burton wrote: I'm coming from a C++ background so I'm not too used to garbage collection and it's implications. I have a function that creates a std.socket.Socket using new and connects to a tcp server, and writes some stuff to it. I then

What is best way to link DlangUI widget and program logic?

2017-06-28 Thread Murzistor via Digitalmars-d-learn
I want to call a method of the certain instance of "MyClass" from certain widget. Each widget should know its corresponding instance of "MyClass". As far as I understood, delegates cannot do it.

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-27 17:24, Steven Schveighoffer wrote: Yes, Tango solved this by having a separate "finalize()" method. I wish we had something like this. Not sure if this is the same, but I remember that Tango had a separate method called "dispose" that was called if a class was allocated on the

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-27 11:54, John Burton wrote: I'm coming from a C++ background so I'm not too used to garbage collection and it's implications. I have a function that creates a std.socket.Socket using new and connects to a tcp server, and writes some stuff to it. I then explicitly close the socket,