Re: Where can I find a reference for compiler flags?
On Sunday, 9 June 2019 at 19:12:32 UTC, Mike Brockus wrote: On Wednesday, 5 June 2019 at 09:45:53 UTC, Jacob Carlborg wrote: On 2019-06-05 03:19, Mike Brockus wrote: Where can I find a reference for compiler flags? Here's the reference [1]. You can also run "dmd --help" to print out the available flags. [1] might not be up to date. [1] https://dlang.org/dmd-windows.html This bit of information was helpful. But do you know what this is -dip- followed by some number... I seen three of them in Mir Algorithm meson build. A DIP is a D improvement proposal. It is basically a request for a change of the language. Some of these can be implemented in one go, as they don't have any breaking changes. However, some DIPs break an unknown amount of code. To allow for a smooth transition, the new features are implemented, and are opt-in. Users can then gradually get their code base to compile with the new behaviour. The DIP flags indicate that the compiler will build your code with said improvement enabled. The three DIPs you are talking about are * dip25 which implements https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md This is about sealed references. If I understand correctly, switching this flag requires that you annotate a ref function parameter with return if you want to return it from the function. * dip1000 which implements https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md This implements more scope checking for pointers. It hands a few extra safety checks for when pointers may last longer than the data they actually point to. * dip1008 which implements https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md This allows users to throw exceptions in @nogc code. For completeness, they correspond to the current "-preview=dipX" compiler flag. They have been grouped together under the "preview" option because they were cluttering the interface. In fact, I gathered the information in this post by running "-preview=?", listing all features here. Also, at some time in the future, a preview will become the default behaviour.
Re: Where can I find a reference for compiler flags?
On Wednesday, 5 June 2019 at 09:45:53 UTC, Jacob Carlborg wrote: On 2019-06-05 03:19, Mike Brockus wrote: Where can I find a reference for compiler flags? Here's the reference [1]. You can also run "dmd --help" to print out the available flags. [1] might not be up to date. [1] https://dlang.org/dmd-windows.html This bit of information was helpful. But do you know what this is -dip- followed by some number... I seen three of them in Mir Algorithm meson build.
Re: What external libraries are available
On Wednesday, 5 June 2019 at 10:48:37 UTC, 9il wrote: On Wednesday, 5 June 2019 at 01:20:46 UTC, Mike Brockus wrote: If you never herd about Meson before: 🤔. https://mesonbuild.com/ Hay there I was just wondering, what is the D equivalent to C++ Boost and or Poco libraries? Just wondering because I would like to start playing with other developers libraries and use them in a collection of examples for the library. The examples will be lunched to a GitHub repository as a show case so the library developers can show a link to new potential users that seek examples. What I mean by Boost or Poco equivalent is a grouping of fully functional packages/modules. It’s ok if you recommend a single library and it is a plus if Meson build is apart of the library. I am aware of Mir Libraries being a group of libraries and incorporates the use of Meson, however I normally like to see what my options are to better plan my applications. https://github.com/libmir/mir-algorithm https://github.com/libmir/mir-core https://github.com/libmir/mir-optim https://github.com/libmir/mir-rundom https://github.com/libmir/mir-runtime (exprimental) All of them comes with Meson and are used in daily production. Thanks for the suggestion to use LibMir, I will get started on the collections somewhere around winter or after I finish writing C, C++ examples based on the cpp-reference but embrace the importance of safe and secure software and other best practices.
Re: Alias overload of function
On Sunday, 9 June 2019 at 10:42:12 UTC, Basile-z wrote: On Sunday, 9 June 2019 at 10:22:36 UTC, Andrey wrote: Hello, I have got 2 functions: void myFunc(string name, int a)(wstring value) {} void myFunc(string name, int a)() {} I want to make an alias (for example for second function without argument): alias myAlias(int a) = myFunc!("Name", a); but compiler says: ... matches more than one template declaration So how solve this problem? use __traits(getOverloads) to apply to all of them in a static foreach. Hmm... Cannot understand how to write getOverloads. My case: struct Outer { static template Inner(alias a, alias b, T) { void myFunc() {} } } This doesn't work (inside Outer): pragma(msg, __traits(getOverloads, Inner, "myFunc", true));
meson and d
hi, i need some meson configuration that works with dmd and ldc my setting don't work. because meson complains it cannot find the d compiler. d compiler can be invoked on command line. i use : set dmd_path="path/to/d/base" set PATH=%dmd_path%\bin;%PATH%; mingw can be detected by setting GCC_HOME i use win7 and x86 meson 0.50.1
Re: Using python in D
On Sun, 2019-06-09 at 03:42 +, rnd via Digitalmars-d-learn wrote: > […] > I also wanted to know: Once executable is successfully created, > will it work on systems where Python and pandas are not installed? I suspect not, but then I do not use Windows. I would be surprised if the executable was self contained since that would imply loading the Python VM, it's standard library, and the used extenal packages. py2exe does though do this sort of thing so maybe PyD can. I do not know, sorry. -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: Alias overload of function
On Sunday, 9 June 2019 at 10:22:36 UTC, Andrey wrote: Hello, I have got 2 functions: void myFunc(string name, int a)(wstring value) {} void myFunc(string name, int a)() {} I want to make an alias (for example for second function without argument): alias myAlias(int a) = myFunc!("Name", a); but compiler says: ... matches more than one template declaration So how solve this problem? use __traits(getOverloads) to apply to all of them in a static foreach.
Alias overload of function
Hello, I have got 2 functions: void myFunc(string name, int a)(wstring value) {} void myFunc(string name, int a)() {} I want to make an alias (for example for second function without argument): alias myAlias(int a) = myFunc!("Name", a); but compiler says: ... matches more than one template declaration So how solve this problem?
Re: Can D optimize?
On Sunday, 9 June 2019 at 05:24:56 UTC, Amex wrote: Can dmd or ldc optimize the following cases: foo(int x) { if (x > 10 && x < 100) bar1; else bar2; } ... for(int i = 23; i < 55; i++) foo(i); // equivalent to calling bar1(i) clearly i is within the range of the if in foo and so the checks are unnecessary. This is a simple case of inlining for the optimizer, so works out well with LDC and GDC: https://d.godbolt.org/z/pLy8Yy -Johan
Re: Using python in D
On Sunday, 9 June 2019 at 03:42:23 UTC, rnd wrote: Thanks for guidance. I also wanted to know: Once executable is successfully created, will it work on systems where Python and pandas are not installed? That is unlikely. PyD is just a D package, it doesn't have the ability to mess up with your project files to pack proper shippable app. On linux it also adds complexity due the way how dynamic libraries are handled (i.e. need to set this fancy RPATH, LD_LIBRARY_PATH, whatever else necessary), so I would first make isolated python copy using venv(and install required packages) and then copy it to your final redistributable dir, might also require messing a bit with linker flags (to tell where to look for shared libs), but anyway it all depends on what prebuilt python depends, for example it will likely fail if run on older distro or just distro with older libc, or if any of its other dependencies being older or missing. As for py_import issue you can also try do import within py_stmt and see if it works(assuming python has all relevant paths set up).