Re: std.math module

2017-08-06 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 6 August 2017 at 23:33:26 UTC, greatsam4sure wrote: import std.math; import std.stdio; cos(90*PI/180) = -2.7e-20 instead of zero. I will appreciate any help. thanks in advance. tan(90*PI/180) = -3.689e+19 instead of infinity. What is the best way to use this module in addition

Re: Getting enum from value

2017-08-06 Thread Kreikey via Digitalmars-d-learn
On Saturday, 5 August 2017 at 20:11:27 UTC, Matthew Remmel wrote: On Saturday, 5 August 2017 at 18:26:10 UTC, Kreikey wrote: On Saturday, 5 August 2017 at 15:33:57 UTC, Matthew Remmel wrote: I feel like I'm missing something, but there has to be an easier way to convert a value into an enum

Re: std.math module

2017-08-06 Thread sarn via Digitalmars-d-learn
On Sunday, 6 August 2017 at 23:33:26 UTC, greatsam4sure wrote: import std.math; import std.stdio; cos(90*PI/180) = -2.7e-20 instead of zero. I will appreciate any help. thanks in advance. tan(90*PI/180) = -3.689e+19 instead of infinity. What is the best way to use this module That's just

Re: rename file, execute os, etc at compile time

2017-08-06 Thread Johnson Jones via Digitalmars-d-learn
On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote: On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote: is it possible to do? I would like to pre-configure some stuff at "pre-compilation"(in ctfe but before the rest of the program actually gets compiled). I know it's

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 17:16:05 UTC, bitwise wrote: I was referring specifically to storing gc_malloc'ed pointers on the stack, meaning that I'm calling a C++ function on a D call stack, and storing the pointer as a local var in the C++ function before returning it to D. The more I

ldc D compiler installation on windows 10

2017-08-06 Thread greatsam4sure via Digitalmars-d-learn
Good day. I will appreciate it if anybody here can help me with the step by step way of installing ldc D compiler on windows. I have read online info but i just don't get it. let the process be in steps for easy comprehension.thanks in advance

std.math module

2017-08-06 Thread greatsam4sure via Digitalmars-d-learn
import std.math; import std.stdio; cos(90*PI/180) = -2.7e-20 instead of zero. I will appreciate any help. thanks in advance. tan(90*PI/180) = -3.689e+19 instead of infinity. What is the best way to use this module

ldc instation on windows 10

2017-08-06 Thread greatsam4sure via Digitalmars-d-learn
Good day. I will appreciate it if anybody here can help me with the step by step way of installing ldc D compiler on windows. I have read online info but i just don't get it. let the process be in steps for easy comprehension.thanks in advance

Re: rename file, execute os, etc at compile time

2017-08-06 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote: is it possible to do? I would like to pre-configure some stuff at "pre-compilation"(in ctfe but before the rest of the program actually gets compiled). I know it's not safe and all that but in my specific case it would help.

Re: lambda function with "capture by value"

2017-08-06 Thread bitwise via Digitalmars-d-learn
On Saturday, 5 August 2017 at 18:17:49 UTC, Simon Bürger wrote: If a lambda function uses a local variable, that variable is captured using a hidden this-pointer. But this capturing is always by reference. Example: int i = 1; auto dg = (){ writefln("%s", i); }; i = 2; dg(); //

Re: lambda function with "capture by value"

2017-08-06 Thread Simon Bürger via Digitalmars-d-learn
On Sunday, 6 August 2017 at 12:50:22 UTC, Adam D. Ruppe wrote: On Saturday, 5 August 2017 at 19:58:08 UTC, Temtaime wrote: (k){ dgs[k] = {writefln("%s", k); }; }(i); Yeah, that's how I'd do it - make a function taking arguments by value that return the delegate you actually

rename file, execute os, etc at compile time

2017-08-06 Thread Johnson Jones via Digitalmars-d-learn
is it possible to do? I would like to pre-configure some stuff at "pre-compilation"(in ctfe but before the rest of the program actually gets compiled). I know it's not safe and all that but in my specific case it would help. I'll probably use pre-build events, which is probably the best,

Re: gtkD: events being triggered twice

2017-08-06 Thread FoxyBrown via Digitalmars-d-learn
On Sunday, 6 August 2017 at 18:26:20 UTC, Mike Wey wrote: On 06-08-17 16:58, FoxyBrown wrote: I don't really(my code is a bit more complex) but basically all it boils down to is a UI with some nested widgets (an overlay, an box, and a box and one contains the eventbox which I added those

Re: gtkD: events being triggered twice

2017-08-06 Thread Mike Wey via Digitalmars-d-learn
On 06-08-17 16:58, FoxyBrown wrote: I don't really(my code is a bit more complex) but basically all it boils down to is a UI with some nested widgets (an overlay, an box, and a box and one contains the eventbox which I added those callbacks on. I think that something like

Re: returning D string from C++?

2017-08-06 Thread bitwise via Digitalmars-d-learn
On Sunday, 6 August 2017 at 16:46:40 UTC, Mike Parker wrote: On Sunday, 6 August 2017 at 16:23:01 UTC, bitwise wrote: So I guess you're saying I'm covered then? I guess there's no reason I can think of for the GC to stop scanning at the language boundary, let alone any way to actually do that

Re: lambda function with "capture by value"

2017-08-06 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2017-08-06 at 12:50 +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Saturday, 5 August 2017 at 19:58:08 UTC, Temtaime wrote: > >   (k){ dgs[k] = {writefln("%s", k); }; }(i); > > Yeah, that's how I'd do it - make a function taking arguments by  > value that return the

VibeD - REST API and vibed.web.auth framework

2017-08-06 Thread holo via Digitalmars-d-learn
Hello I'm trying to use auth framework with REST api ( http://vibed.org/api/vibe.web.auth/ ). Is it possible to use it with registerRestInterface? According to description under: http://vibed.org/api/vibe.web.auth/requiresAuth it should be available on both Web and REST. Here is my

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 16:23:01 UTC, bitwise wrote: So I guess you're saying I'm covered then? I guess there's no reason I can think of for the GC to stop scanning at the language boundary, let alone any way to actually do that efficiently. It's not something you can rely on. If the

Re: returning D string from C++?

2017-08-06 Thread bitwise via Digitalmars-d-learn
On Sunday, 6 August 2017 at 05:31:51 UTC, Marco Leise wrote: Am Sat, 05 Aug 2017 20:17:23 + schrieb bitwise : [...] In due diligence, you are casting an ANSI string into a UTF-8 string which will result in broken Unicode for non-ASCII window titles. In any case it is

Re: returning D string from C++?

2017-08-06 Thread bitwise via Digitalmars-d-learn
On Saturday, 5 August 2017 at 21:18:29 UTC, Jeremy DeHaan wrote: On Saturday, 5 August 2017 at 20:17:23 UTC, bitwise wrote: I have a Windows native window class in C++, and I need a function to return the window title. [...] As long as you have a reachable reference to the GC memory

Re: Create class on stack

2017-08-06 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 6 August 2017 at 15:24:55 UTC, Jacob Carlborg wrote: On 2017-08-05 19:08, Johnson Jones wrote: using gtk, it has a type called value. One has to use it to get the value of stuff but it is a class. Once it is used, one doesn't need it. Ideally I'd like to treat it as a struct since

Re: Create class on stack

2017-08-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-08-05 19:08, Johnson Jones wrote: using gtk, it has a type called value. One has to use it to get the value of stuff but it is a class. Once it is used, one doesn't need it. Ideally I'd like to treat it as a struct since I'm using it in a delegate I would like to minimize unnecessary

Re: gtkD window centering message up and no app on taskbar

2017-08-06 Thread Johnson Jones via Digitalmars-d-learn
On Saturday, 5 August 2017 at 20:56:10 UTC, Mike Wey wrote: On 05-08-17 20:14, Johnson Jones wrote: When trying to center the window. If one uses ALWAYS_CENTERED any resizing of the window is totally busted. CENTER also does not work. move(0,0) seems to not be relative to the main display.

Re: gtkD: events being triggered twice

2017-08-06 Thread FoxyBrown via Digitalmars-d-learn
On Sunday, 6 August 2017 at 09:42:03 UTC, Mike Wey wrote: On 06-08-17 03:25, Johnson Jones wrote: GtkEventBox - Enter GtkEventBox - Enter Down GtkEventBox - Leave Up GtkEventBox - Leave GtkEventBox - Leave That is when I move the mouse over the event box then click then move out out then

Re: lambda function with "capture by value"

2017-08-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 5 August 2017 at 19:58:08 UTC, Temtaime wrote: (k){ dgs[k] = {writefln("%s", k); }; }(i); Yeah, that's how I'd do it - make a function taking arguments by value that return the delegate you actually want to store. (Also use this pattern in Javascript btw for its

Re: lambda function with "capture by value"

2017-08-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 5 August 2017 at 18:37:31 UTC, Johnson Jones wrote: 1. I'm pretty sure that D creates the delegate "lazily" in the sense that the first call is what captures the variable. It actually does it at function entry, allocating the memory for the locals in the closure, so it never

Re: Create class on stack

2017-08-06 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 6 August 2017 at 02:19:19 UTC, FoxyBrown wrote: [...] I don't think you understand what I'm saying. If I use this method to create a "reference" type on the stack rather than the heap, is the only issue worrying about not having that variable be used outside that scope(i.e., have

Re: gtkD: events being triggered twice

2017-08-06 Thread Mike Wey via Digitalmars-d-learn
On 06-08-17 03:25, Johnson Jones wrote: GtkEventBox - Enter GtkEventBox - Enter Down GtkEventBox - Leave Up GtkEventBox - Leave GtkEventBox - Leave That is when I move the mouse over the event box then click then move out out then release. I would expect Enter Down Leave Up The fact that

Re: gtkD load images

2017-08-06 Thread Mike Wey via Digitalmars-d-learn
On 05-08-17 22:59, ag0aep6g wrote: On 08/05/2017 10:30 PM, Mike Wey wrote: On 05-08-17 15:23, Johnson Jones wrote: On Saturday, 5 August 2017 at 12:51:13 UTC, Mike Wey wrote: [...] There are two issues here, you need to properly escape the slash: "C:a.jpg". [...] ``` Pixbuf p = new

Re: D on AArch64 CPU

2017-08-06 Thread Joakim via Digitalmars-d-learn
On Sunday, 6 August 2017 at 06:26:57 UTC, David J Kordsmeier wrote: Also, why I don't look at LDC further, I think RAM on the embedded devices is still pretty skimpy, Raspi3 only has 1GB ram. It's not great for compiling with the LLVM-based things and probably run OOM. Other devices I have

Re: D on AArch64 CPU

2017-08-06 Thread David J Kordsmeier via Digitalmars-d-learn
On Sunday, 14 May 2017 at 15:05:08 UTC, Richard Delorme wrote: I recently bought the infamous Raspberry pi 3, which has got a cortex-a53 4 cores 1.2 Ghz CPU (Broadcom). After installing on it a 64 bit OS (a non official fedora 25), I was wondering if it was possible to install a D compiler on