Re: @safe - why does this compile?

2018-07-14 Thread Timoses via Digitalmars-d-learn
On Friday, 13 July 2018 at 22:17:59 UTC, Dukc wrote: On Friday, 13 July 2018 at 13:52:27 UTC, Timoses wrote: I suppose this is another good example of how casting can be dangerous? E.g. also: immutable int i = 3; int* j = cast(int*)&i; assert(i == 3); *j = 4; assert(j

Re: Orange not working?

2018-07-14 Thread Timoses via Digitalmars-d-learn
On Friday, 13 July 2018 at 21:38:18 UTC, JN wrote: I'm curious, are the tests in any way OS specific? I see the tests are passing, but trying the latest DMD on Windows and orange v2.0.0, when I add "@nonSerialized" to a struct member, I get this: C:\Users\jacek\Desktop\test_orange>dub run P

how to compile D programs without console window

2018-07-14 Thread Flaze07 via Digitalmars-d-learn
how do you compile a D programs without a console window ? I found this link https://wiki.dlang.org/D_for_Win32 I know that you need .def file, but how do you link to .def ?

Re: how to compile D programs without console window

2018-07-14 Thread rikki cattermole via Digitalmars-d-learn
On 14/07/2018 9:32 PM, Flaze07 wrote: how do you compile a D programs without a console window ? I found this link https://wiki.dlang.org/D_for_Win32 I know that you need .def file, but how do you link to .def ? WinAPI: FreeConsole(); Optlink linker (default for 32bit): -L/SUBSYSTEM:windows

Re: how to compile D programs without console window

2018-07-14 Thread Flaze07 via Digitalmars-d-learn
On Saturday, 14 July 2018 at 09:39:21 UTC, rikki cattermole wrote: If you're using dub, throw them into lflags and remove the -L. https://forum.dlang.org/post/gmcsxgfsfnwllploo...@forum.dlang.org hmm, for some unknown reason it says that it is unable to find SUBSYSTEM:windows.lib

Call method with Variant array as parameters

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, I have a class with methods and I want to call a method by using a variant array. The length of the array and the types exactly fits the method signature. In the last line of main you see the coding which should be generated. I need some coding which looks at the signature of bar and use

Re: Call method with Variant array as parameters

2018-07-14 Thread Timoses via Digitalmars-d-learn
On Saturday, 14 July 2018 at 11:08:21 UTC, Andre Pany wrote: Hi, I have a class with methods and I want to call a method by using a variant array. The length of the array and the types exactly fits the method signature. In the last line of main you see the coding which should be generated.

Re: Call method with Variant array as parameters

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 14 July 2018 at 11:37:20 UTC, Timoses wrote: On Saturday, 14 July 2018 at 11:08:21 How about this? import std.variant: Variant; import std.traits : isCallable; class Foo { void bar(string s, long l) { import std.stdio : writeln; writeln(s); writeln(l);

Re: Check whether a range is empty

2018-07-14 Thread vino.B via Digitalmars-d-learn
On Friday, 13 July 2018 at 19:45:03 UTC, Steven Schveighoffer wrote: On 7/13/18 3:29 PM, vino.B wrote: [...] Well, empty is how you detect whether any range is empty, and as far as ranges are concerned, your code is correctly checking for empty. A couple comments: 1. Why are you using c

Re: Check whether a range is empty

2018-07-14 Thread vino.B via Digitalmars-d-learn
On Saturday, 14 July 2018 at 14:28:52 UTC, vino.B wrote: On Friday, 13 July 2018 at 19:45:03 UTC, Steven Schveighoffer wrote: On 7/13/18 3:29 PM, vino.B wrote: [...] Well, empty is how you detect whether any range is empty, and as far as ranges are concerned, your code is correctly checki

Find out druntime/import and phobos folder on Linux

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, The IntelliJ D Language plugin has support for D-scanner and DCD. Both tools needs to know the paths to druntime/import and Phobos source folder. In IntelliJ you set the path to the folder where dmd binary is located. Based on this information on Windows and MacOS it is possible to determ

Re: Check whether a range is empty

2018-07-14 Thread Ali Çehreli via Digitalmars-d-learn
First, please show us code that demonstrates the issue. On 07/14/2018 07:47 AM, vino.B wrote: >The reason it never prints the text "Empty" is that the out of the > "r" is just an empty array. > > OUTPUT: > [] > [] If that's the output of r, then r is not empty but has two elements and thos

Re: Find out druntime/import and phobos folder on Linux

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 14 July 2018 at 19:00:56 UTC, Anonymouse wrote: On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote: Is there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr

Re: Find out druntime/import and phobos folder on Linux

2018-07-14 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote: Is there a way to find out both paths based on the dmd executable folder? What I found out so far, these paths are not always correct: /usr/include/dmd/druntime/import /usr/include/dmd/phobos Arch Linux and derivatives keep them und

Re: Find out druntime/import and phobos folder on Linux

2018-07-14 Thread Mike Franklin via Digitalmars-d-learn
On Saturday, 14 July 2018 at 19:04:01 UTC, Andre Pany wrote: Somehow also the DMD executable needs to know which Phobos/DRuntime it should use. How does DMD is working here? Maybe I can do the same... DMD determines default import and library paths from the dmd.conf file typically at /etc/dm

Is there any tool that will auto publish my changes.

2018-07-14 Thread Venkat via Digitalmars-d-learn
I am writing a simple vibe.d app. The following is what I do right now. - I make changes. - build - Restart the server. Is there any tool that will auto publish my changes as I save them ? I am using Visual Studio Code. Thanks Venkat

Re: how to compile D programs without console window

2018-07-14 Thread evilrat via Digitalmars-d-learn
On Saturday, 14 July 2018 at 09:43:48 UTC, Flaze07 wrote: On Saturday, 14 July 2018 at 09:39:21 UTC, rikki cattermole wrote: If you're using dub, throw them into lflags and remove the -L. https://forum.dlang.org/post/gmcsxgfsfnwllploo...@forum.dlang.org hmm, for some unknown reason it says that

Re: @safe - why does this compile?

2018-07-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/14/18 2:50 AM, Timoses wrote: On Friday, 13 July 2018 at 22:17:59 UTC, Dukc wrote: On Friday, 13 July 2018 at 13:52:27 UTC, Timoses wrote: I suppose this is another good example of how casting can be dangerous? E.g. also:     immutable int i = 3;     int* j = cast(int*)&i;     assert(i =

Re: how to compile D programs without console window

2018-07-14 Thread Flaze07 via Digitalmars-d-learn
On Sunday, 15 July 2018 at 01:20:25 UTC, evilrat wrote: ... "lflags": [ "/SUBSYSTEM:windows" ], ... didn't know that, thank you