Re: selective tests

2019-10-12 Thread Seb via Digitalmars-d-learn
On Saturday, 12 October 2019 at 13:50:46 UTC, IGotD- wrote: On Saturday, 12 October 2019 at 09:52:59 UTC, Jonathan M Davis wrote: [...] This would be helpful. About all C++ unit test frameworks have named test and you can select a specific one or several in the command line. Very useful when

Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Seb via Digitalmars-d-learn
On Friday, 18 October 2019 at 10:55:59 UTC, Martin Tschierschke wrote: On Friday, 18 October 2019 at 10:23:28 UTC, jmh530 wrote: On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke wrote: [snip] I think this is something that's been proposed before, but most people are happy with

Re: dub build doesn't work

2019-10-22 Thread Seb via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 22:14:02 UTC, OiseuKodeur wrote: Hello, i am having a problem with dub build with this project https://github.com/OiseauKodeur/cervelet/tree/master/source when i try to compile everything go well but when i click to run the .exe it give my an error missing msvcr1

Re: Is there any writeln like functions without GC?

2019-11-02 Thread Seb via Digitalmars-d-learn
On Thursday, 31 October 2019 at 16:03:22 UTC, bachmeier wrote: On Thursday, 31 October 2019 at 15:11:42 UTC, Ferhat Kurtulmuş wrote: It would be nice if one reimplement writeln of Phobos by bypassing gc and use a custom nogc exception as described here*? Of course I can imagine that it would

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread Seb via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:30:33 UTC, zoujiaqing wrote: 1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in powershell is OK 5. dub ini myproject (no dependency) 6. Run `cd m

Re: Dub - vibe.d - hunt framework ... problems

2020-02-01 Thread Seb via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: Hi I want to start a small server, that will be accessible form outside. Not a huge deal right? Not quite. [...] What version of dub did you install? 1.19 should be the latest.

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Seb via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: We're looking for a way to speed up compilation of template-heavy code. So we are trying to find out which parts of the code that is most costly to compile. Is there a dmd flag that shows the code after template instantiations

Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-26 Thread Seb via Digitalmars-d-learn
On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote: ```test.d void main () { int [] v = new int [10]; } ``` $ [...]linux/bin32/dmd test $ gdb test [...] (gdb) r [...] Program received signal SIGILL, Illegal instruction. 0x0809ad14 in _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKk

Re: How to run program with "dmd -i" compiler swich ?

2020-05-15 Thread Seb via Digitalmars-d-learn
On Friday, 15 May 2020 at 14:09:00 UTC, Vinod K Chandran wrote: Hi, For some unknown reasons, dub is not working for me. But i can build my program with "dmd -i". But i would like to know if there is any code to run my program with "dmd -i". Note : "rdmd" is also working but it creates the exe

Re: any chance to get it working on windows xp?

2020-05-17 Thread Seb via Digitalmars-d-learn
On Sunday, 17 May 2020 at 22:30:22 UTC, a beginner wrote: [...] You could try grabbing a newer dub release binary from here: https://github.com/dlang/dub/releases There are two versions (installer + zip archive). It looks like you're better off with the zip archive. Alternatively, if you

Re: DMD 2.092 and DIP 25

2020-05-30 Thread Seb via Digitalmars-d-learn
On Saturday, 30 May 2020 at 07:00:07 UTC, Mike Parker wrote: The following declarations now give a deprecation warning: ```d struct ErrorInfo { private: char[32] _error; char[96] _message; public @nogc nothrow @property: /** Returns the string "Missing Symbol" to indicate a

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing and foreach (i, e; range) { ... } doesn't work from the get-go? I wouldn't have such an issue with it if static foreach would work with enumerate just fine. As f

Re: 32 bit phobos

2020-06-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 17:58:56 UTC, welkam wrote: I tried to compile a 32 bit executable but my system does not have 32 bit phobos. How do I get 32 bit phobos? I am using Manjaro. dmd -m32 source/test2.d /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Seb via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 01:35:32 UTC, Q. Schroll wrote: On Wednesday, 10 June 2020 at 00:53:30 UTC, Seb wrote: It's a bit more complicated though as you need to avoid subtle breakage with ranges that return tuples that are auto-expanded like e.g. `foreach (k,v; myDict)`. Okay, I can acc

Re: BetterC + WASM Update

2020-09-02 Thread Seb via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 20:39:58 UTC, Mike Brown wrote: Hi All, Thank you for your replies. My tests have been via compiler explorer. https://godbolt.org/z/4f9nKj I have done this without -BetterC, as the dynamic array fails. I guess that uses GC? Is there an alternative that works

Re: A function to split a range into several ranges of different chunks

2020-09-14 Thread Seb via Digitalmars-d-learn
On Monday, 14 September 2020 at 07:49:31 UTC, Andrej Mitrovic wrote: - import std.range; import std.stdio; void main () { auto range = sequence!((a, n) => n); // works, but the chunks are all the same length auto rngs = range.chunks(4); writeln(rngs[0]); writeln(rngs[1])

Re: trouble building dlang.org

2018-04-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 10 April 2018 at 15:58:10 UTC, Zach Tollen wrote: I'm trying to update the language spec. I have the standard dmd installed on my Mac in `~/dlang/dmd` using the install script from the website "curl -fsS https://dlang.org/install.sh | bash -s dmd". Okay, good, done. Actually no D

Re: Passing to c++ std::string and vector

2018-04-30 Thread Seb via Digitalmars-d-learn
On Monday, 30 April 2018 at 01:07:35 UTC, NewUser wrote: Hi, How do I pass a d string to a c++ std::string? NewUser There's https://github.com/dlang/druntime/pull/1316 (an attempt at making C++ standard library)

Re: Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 09:36:23 UTC, Robert M. Münch wrote: Hi, digger won't build because it sees some local changes to file, which I didn't do: [...] Works fine for me with 2.080.0. Did you maybe modify your working directory locally? If so, try nuking `work` away. (btw digger is us

Re: Digger v3.0 alpha 5 / DMD 2.080.0 / Can't build...

2018-05-02 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 21:13:03 UTC, Robert M. Münch wrote: On 2018-05-02 09:39:41 +, Seb said: [...] Hi, not that I know about... [...] Looks like it's an issue with the windows bootstrapping. I would recommend to report a bug to Vladimir's issue tracker: https://github.com/Cyber

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Seb via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 12:37:42 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 12:19:14 UTC, Adam D. Ruppe wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: [...] This one needs to be compiled+run with the dub package manager instead of with rdmd, which is why it has that shebang l

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Seb via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 18:40:34 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 17:35:13 UTC, Jesse Phillips wrote: [...] Tested with these versions so far, and had all the same errors: C:\Users\Vaidas>dmd --version DMD32 D Compiler v2.079.1

Re: Building dmd/druntime on windows issue

2018-05-10 Thread Seb via Digitalmars-d-learn
On Thursday, 10 May 2018 at 18:38:30 UTC, Andre Pany wrote: Hi, I follow the instructions from the wiki to build dmd/druntime from source on windows. https://wiki.dlang.org/Building_under_Windows [...] Which DMD/druntime do you try to build? IIRC there are some issues with the release ball,

Re: Stack traces with DMD on OSX

2018-05-31 Thread Seb via Digitalmars-d-learn
On Thursday, 31 May 2018 at 09:11:41 UTC, pineapple wrote: When I run code on OSX and it produces a stack trace, the output uses mangled symbols and is missing line numbers, like so - how can I change these stack traces to be more readable? [...] Use DMD master - support for line numbers in

Re: GDC on Travis-CI

2018-06-02 Thread Seb via Digitalmars-d-learn
On Saturday, 2 June 2018 at 16:04:09 UTC, Matthias Klumpp wrote: On Saturday, 2 June 2018 at 03:15:56 UTC, crimaniak wrote: I started to work with Travis-CI, building packages using all three main compilers, and noticed that I have problems with gdc every time and need to tweak code because of

Re: Static Array Idiom not working anymore.

2018-06-12 Thread Seb via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 14:35:33 UTC, SrMordred wrote: this idiom for creating static array used to work, but they are failing now. What changed and whats the alternative? (from https://p0nce.github.io/d-idioms/#@nogc-Array-Literals:-Breaking-the-Limits) T[n] s(T, size_t n)(auto ref T[n]

Re: range.put() to Empty Array Causes Error?

2018-06-17 Thread Seb via Digitalmars-d-learn
On Sunday, 17 June 2018 at 12:23:55 UTC, Steven Schveighoffer wrote: On 6/17/18 7:07 AM, Vijay Nayar wrote: This code breaks with the following error: void main() { import std.range;   int[] vals = []; vals.put(3); } /src/phobos/std/range/primitives.d(2328): Attempting to fetch t

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-02 Thread Seb via Digitalmars-d-learn
On Monday, 2 July 2018 at 19:24:38 UTC, Chris M. wrote: On Monday, 2 July 2018 at 18:48:16 UTC, Jonathan M Davis wrote: On Monday, July 02, 2018 18:26:27 Chris M. via Digitalmars-d-learn wrote: On Monday, 2 July 2018 at 17:33:20 UTC, Bauss wrote: > [...] Thanks for checking, I have no idea wha

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-02 Thread Seb via Digitalmars-d-learn
On Monday, 2 July 2018 at 23:00:08 UTC, Chris M. wrote: On Monday, 2 July 2018 at 21:20:26 UTC, Seb wrote: On Monday, 2 July 2018 at 19:24:38 UTC, Chris M. wrote: On Monday, 2 July 2018 at 18:48:16 UTC, Jonathan M Davis wrote: [...] Downloaded the DMD and DMC zip files, extracted and added t

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Seb via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 15:10:34 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 14:38:53 UTC, Mike Parker wrote: On Tuesday, 3 July 2018 at 13:32:21 UTC, Chris M. wrote: After hashing it out with some people on the Discord, I'm fairly certain we narrowed it down to the 64-bit user32.lib

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 01:06:36 UTC, Joe wrote: The subject basically says it all. The C function uses the argument to call fprintf and also passes it to other functions where it's used to call fileno, fprintf or putc. Like you would with C's fprintf (https://dlang.org/phobos/core_stdc_

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:08:11 UTC, Joe wrote: On Wednesday, 4 July 2018 at 01:58:15 UTC, Seb wrote: So just add the declaration to your D file: --- extern(C) void myCfunction(FILE* stream); --- I do have a similar declaration in D. It appears the problem is that the C program I'm tr

Re: Using C++ with D / returning a templated type from C++

2018-07-05 Thread Seb via Digitalmars-d-learn
On Thursday, 5 July 2018 at 06:35:01 UTC, Robert M. Münch wrote: So, the only difference left is the C++ static and the additional __ptr64 (whatever this is) on the D side. Any further ideas? Could you post your current C++ and D files? So, how or where could such a collection be done? Wel

Re: Better diagnostics for null classes dereferencing

2018-07-10 Thread Seb via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 19:01:22 UTC, Per Nordlöw wrote: Is it possible to change run-time behaviour of null-class dereferencing, on Linux, so that it gives some other diagnostics than: Program exited with code -11 Does DMD and LDC provide different alternatives here? On a Systemd syste

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-10 Thread Seb via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: I'm specifically thinking of the GNU Octave codebase: http://hg.savannah.gnu.org/hgweb/octave/file/@ It's a fairly old and complicated C++ codebase. I would like to see if I could slowly introduce some D in it, anywhere

Re: Better diagnostics for null classes dereferencing

2018-07-10 Thread Seb via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 20:57:02 UTC, Steven Schveighoffer wrote: On 7/10/18 4:02 PM, Per Nordlöw wrote: On Tuesday, 10 July 2018 at 19:27:07 UTC, Steven Schveighoffer wrote: On 7/10/18 3:01 PM, Per Nordlöw wrote: [...] Yes, call this function on startup: import etc.linux :  registerMem

Re: Using dub and rdmd together?

2018-07-11 Thread Seb via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 16:13:56 UTC, Matthew OConnor wrote: Hi, I'm new to D and trying to make some command line tools that are run with `#!/usr/bin/env rdmd`. But I would also like to reference external packages from dub. I know I can do this with: #!/usr/bin/env dub /+ dub.

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-12 Thread Seb via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 20:38:13 UTC, Dukc wrote: On Wednesday, 11 July 2018 at 19:41:37 UTC, Jordi Gutiérrez Hermoso wrote: Just getting it into -betterC territory seems like a very daunting task. You do not need -betterC anymore. At least the LDC frontend will only add linking hooks f

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

2018-07-15 Thread Seb via Digitalmars-d-learn
On Saturday, 14 July 2018 at 17:19:20 UTC, Andre Pany wrote: 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 t

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote: On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows very little from the redistributable parts of dscripten - mostly the "minimalistic runtime", which I think

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:15:56 UTC, Timoses wrote: On Monday, 16 July 2018 at 11:31:32 UTC, Seb wrote: On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote: On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:13:53 UTC, Timoses wrote: On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote: On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you ment

Re: names not demangled in nm --demangle=dlang

2018-07-17 Thread Seb via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 15:39:39 UTC, Zheng (Vic) Luo wrote: Hi, I built a simple program with dmd a.d and tried to observe symbols with nm --demangle=dlang ./a. However, I can observe that only part of the symbols (e.g., std.stdio.File.size()) are demangled, while others remain in their o

Re: HMAC and toHexString

2018-07-18 Thread Seb via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote: On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: [...] Ahh, the joys of memory corruption. Yep, actually this one is a very common one. However, -dip1000 would warn you here ...

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 10:27:36 UTC, Zheng (Vic) Luo wrote: Current implementation of d-runtime relies on a lot of symbols from libc, librt, libpthread, which makes it hard to create a minimal runtime used for embedded devices. Although there are some unofficial minimal versions of d-runt

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:40:09 UTC, Zheng (Vic) Luo wrote: On Thursday, 19 July 2018 at 11:35:00 UTC, Seb wrote: Well, since 2.079 it's actually possible to use D without a dependency any runtime (even libc): https://dlang.org/changelog/2.079.0.html#minimal_runtime Also with -betterC

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote: Just tried something similar with new LDC Webassembly support [1] and it fails to compile ... This is a prime example of stuff that should just workTM on targets like that. I would like to submit some fixes but I think there needs to be

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-20 Thread Seb via Digitalmars-d-learn
On Friday, 20 July 2018 at 15:33:19 UTC, Radu wrote: On Thursday, 19 July 2018 at 18:16:17 UTC, kinke wrote: I'll go with Seb's suggestion and look at the betterC tests upstream for issues like this. FYI: I made a reboot of the old PR to a new one which just adds the betterC testsuite: http

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-21 Thread Seb via Digitalmars-d-learn
On Friday, 20 July 2018 at 16:37:24 UTC, Seb wrote: On Friday, 20 July 2018 at 15:33:19 UTC, Radu wrote: On Thursday, 19 July 2018 at 18:16:17 UTC, kinke wrote: I'll go with Seb's suggestion and look at the betterC tests upstream for issues like this. FYI: I made a reboot of the old PR to a n

Re: QWebView requesting QtE5WebEng32.so on windows

2018-07-22 Thread Seb via Digitalmars-d-learn
On Saturday, 21 July 2018 at 19:11:08 UTC, Dr.No wrote: So I went to try out QWebView on Windows from this wrapper: https://github.com/MGWL/QtE5 all the examples went fine until I tried QWebView: https://github.com/MGWL/QtE5/blob/master/examples/webview.d I compile using this command line:

Re: merging a group result

2018-07-23 Thread Seb via Digitalmars-d-learn
On Monday, 23 July 2018 at 11:49:58 UTC, Alex wrote: Hi all, I'm looking for a d-ish way to solve a basic "split-apply-combine" workflow. The idea is described (and solved) here: https://stackoverflow.com/questions/39922986/pandas-group-by-and-sum So, given a structure with some fields, say

Re: trait to get the body code of a function?

2018-07-26 Thread Seb via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 19:10:03 UTC, 12345swordy wrote: On Wednesday, 25 July 2018 at 19:05:08 UTC, Guillaume Lathoud wrote: On Wednesday, 25 July 2018 at 04:46:20 UTC, rikki cattermole wrote: On 25/07/2018 5:32 AM, Guillaume Lathoud wrote: Thanks for all the answers. I've just had a loo

Re: Newbie: out-of-source builds with "dub"?

2018-07-30 Thread Seb via Digitalmars-d-learn
On Monday, 30 July 2018 at 10:23:06 UTC, CC wrote: With "targetPath", it sounds like I'd need to modify a file (DUB's .json file) that's in the source tree to indicate where some(?)/all(?) of the files resulting from the build would be stored. Yes. But it sounds like I'm maybe fighting DUB's

Re: Small program producing binary with large filesize

2018-07-31 Thread Seb via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 15:19:19 UTC, Dan Barbarito wrote: Hi all, I am starting to write a command line tool. So far it is a small (feature-wise) program but the file size is scaring me. It's already 13 megabytes, but I would expect it to be much smaller. Is it because I'm using 3 librar

Re: dtoh

2018-08-06 Thread Seb via Digitalmars-d-learn
On Monday, 6 August 2018 at 13:28:05 UTC, Laeeth Isharc wrote: Hi Walter. Can dtoh be open-sourced now that dmd is? Laeeth. Better write Walter a direct mail. He doesn't check the learn NG very often.

Re: vibe.d: Finding out if currently in webinterface request

2018-08-10 Thread Seb via Digitalmars-d-learn
On Friday, 10 August 2018 at 18:23:28 UTC, Johannes Loher wrote: On Friday, 10 August 2018 at 09:33:34 UTC, Timoses wrote: On Thursday, 9 August 2018 at 21:59:24 UTC, Johannes Loher wrote: I already posted this in the vibe.d forums (https://forum.rejectedsoftware.com/groups/rejectedsoftware.vib

Re: InputRange help: (1) repeated dtor calls and (2) managing resources needing free()

2018-08-13 Thread Seb via Digitalmars-d-learn
On Monday, 13 August 2018 at 04:23:49 UTC, James Blachly wrote: On Thursday, 14 June 2018 at 00:42:25 UTC, James Blachly wrote: ... I assume the (apparent) lack of parity between ctor and dtor is because the "default postblit" (which I figured out for a struct means an empty `this(this)` ctor)

Re: How to declare static compile-time assoc array inside struct?

2018-08-13 Thread Seb via Digitalmars-d-learn
On Monday, 13 August 2018 at 13:21:45 UTC, Andrey wrote: On Monday, 13 August 2018 at 11:53:06 UTC, rikki cattermole wrote: You must use a module constructor to initialize it. Tried this: static this() { Test.DESCRIPTION = [Test.Type.One: "One!", Test.Type.Two: "It's Two...", Test.Type.Th

Re: is this a betterC bug ?

2018-08-14 Thread Seb via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC You can use `static immutable` as a workaround for now: https://run.dlang.i

Re: is this a betterC bug ?

2018-08-14 Thread Seb via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 16:31:38 UTC, Paul Backus wrote: On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC Workaround:

Re: tryTo: non-throwing variant of std.conv.to

2018-08-15 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 09:21:29 UTC, Per Nordlöw wrote: Have anybody thought about non-throwing variants of std.conv.to typically named `tryTo` similar to what Folly https://github.com/facebook/folly/blob/master/folly/docs/Conv.md#non-throwing-interfaces does, for instance, as tr

Re: Deduce type of struct in function arguments

2018-08-20 Thread Seb via Digitalmars-d-learn
On Monday, 20 August 2018 at 12:33:34 UTC, Andrey wrote: On Monday, 20 August 2018 at 11:38:39 UTC, Paul Backus wrote: Create an overload of foo that takes two arguments and combines them into a `Data` struct internally: void foo(int a, string text) { Data data = {a, text}; foo(data);

Re: Deduce type of struct in function arguments

2018-08-21 Thread Seb via Digitalmars-d-learn
On Tuesday, 21 August 2018 at 06:29:12 UTC, Andrey wrote: On Monday, 20 August 2018 at 17:45:25 UTC, Seb wrote: ... yet. Though you can vote for this DIP and show your support there: https://github.com/dlang/DIPs/pull/71 It even comes with an implementation in DMD already: https://github.com

Re: Deduce type of struct in function arguments

2018-08-21 Thread Seb via Digitalmars-d-learn
On Tuesday, 21 August 2018 at 08:47:53 UTC, Mike Parker wrote: On Tuesday, 21 August 2018 at 08:32:17 UTC, Seb wrote: How and where to vote? At the pull request via +1 and the upcoming "official" discussion of the PR. Except that there's no voting process for DIPs. The Community Review

Re: Dub and it's build directory

2018-08-21 Thread Seb via Digitalmars-d-learn
On Tuesday, 21 August 2018 at 12:31:20 UTC, Petar Kirov [ZombineDev] wrote: What Dub does is what it calls "platform probing" [3]. It creates a temporary .d file containing various `pragma (msg, ..)` statements that output information to stderr during compilation. Of course the question is then

Re: What does -vtls compiler flag does and ...

2018-10-04 Thread Seb via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 20:58:01 UTC, Stanislav Blinov wrote: On Wednesday, 3 October 2018 at 20:41:15 UTC, welkam wrote: I was playing around with dmd`s make file trying to see if I can compile dmd with different compilers and different compilation flags. By playing around I found that

Re: DMD release build being faster than debug!

2018-10-05 Thread Seb via Digitalmars-d-learn
On Friday, 5 October 2018 at 14:11:22 UTC, Per Nordlöw wrote: I just noticed that building DMD~master via make -f posix.mak BUILD=debug currently takes 3.2 secs while building it via make -f posix.mak BUILD=release takes only 3.0 secs on my Ubuntu 18.04 64-bit machine! Are there more

Re: Is there a function for this?

2018-10-06 Thread Seb via Digitalmars-d-learn
On Saturday, 6 October 2018 at 13:56:32 UTC, bauss wrote: On Saturday, 6 October 2018 at 13:35:38 UTC, Basile B wrote: On Saturday, 6 October 2018 at 13:17:22 UTC, bauss wrote: [...] see https://www.programming-idioms.org/idiom/119/deduplicate-list. Did you even read my post? I stated I co

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Seb via Digitalmars-d-learn
On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: I'm trying to find the needle in the hay that's an array of strings. So the second assert fails for some reason. Is this expected? https://run.dlang.io/is/7OrZTA ``` #!/usr/bin/rdmd void main() { import std.experimenta

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Seb via Digitalmars-d-learn
On Friday, 7 December 2018 at 19:38:29 UTC, Arun Chandrasekaran wrote: On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: [...] Alternatively to the answers above you can also use a custom lambda for canFind: https:

Re: How do I install a library?

2018-12-10 Thread Seb via Digitalmars-d-learn
On Monday, 10 December 2018 at 00:18:52 UTC, Murilo wrote: Hi guys, thank you for helping me out here, there is this facebook group for the D language, here we can help and teach each other. It is called Programming in D. Please join. https://www.facebook.com/groups/662119670846705/?ref=bookmar

Re: How to build dmd properly?

2018-12-18 Thread Seb via Digitalmars-d-learn
On Tuesday, 18 December 2018 at 14:35:46 UTC, unDEFER wrote: What I could build wrong and how to build dmd properly? Maybe you built dmd.d with debug assertions? (ENABLE_DEBUG=1) You can build dmd with the `./build.d` script or `make -f posix.mak -j4` (assuming you are in `src). Anyway, the

Re: Vibe.d throw link error

2019-01-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 January 2019 at 20:52:26 UTC, greatsam4sure wrote: I am using windows 10. I could not run vibe project. It just give me the error: Error: linker exit with status 1 Dmd failed with exit code 1 I have use different dmd from 0.080 till 0.083. The same error. What is the possible

Re: Generating API documention

2019-01-10 Thread Seb via Digitalmars-d-learn
On Thursday, 10 January 2019 at 07:04:52 UTC, George wrote: What do people use to generate nice looking and simple html documentation for their projects? I would be glad (and if possible), someone could share some actual instructions rather than just tell me ddoc. For example I have seen the li

Re: Reversing a string

2019-01-11 Thread Seb via Digitalmars-d-learn
On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour wrote: Hi. I've just started to learn some D, so maybe this question is extremely stupid, but please bear with me. [...] Use .retro - it is also lazy and won't allocate: https://run.dlang.io/is/A6bjrC

Re: Creating fixed array on stack

2019-01-12 Thread Seb via Digitalmars-d-learn
On Saturday, 12 January 2019 at 13:17:00 UTC, Adam D. Ruppe wrote: On Saturday, 12 January 2019 at 08:10:47 UTC, Andrey wrote: But this requires using of C function "alloca". I think this cause some RT overhead (and in output asm code) in comparison with C++ variant. Or I'm not right? alloca

Re: Reversing a string

2019-01-12 Thread Seb via Digitalmars-d-learn
On Friday, 11 January 2019 at 19:16:05 UTC, AlCaponeJr wrote: On Friday, 11 January 2019 at 11:15:05 UTC, Mike James wrote: Check out the origin :-) https://forum.dlang.org/thread/hl8345$2b1q$1...@digitalmars.com?page=1 Indeed a terrible name, please don't tell me this was chosen by vote.

Re: Runtime heterogeneous collections?

2019-01-17 Thread Seb via Digitalmars-d-learn
On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh wrote: On Thu, 17 Jan 2019 02:21:21 +, Steven O wrote: I want to create a heterogeneous collection of red-black trees, and I can't seem to figure out if it's possible. RedBlackTree!int and RedBlackTree!string are entirely differe

Re: Purpose of template DECLARE_HANDLE in druntime

2019-01-31 Thread Seb via Digitalmars-d-learn
On Thursday, 31 January 2019 at 20:51:37 UTC, Andre Pany wrote: Hi, I noticed in druntime this template is used often: package template DECLARE_HANDLE(string name, base = HANDLE) { mixin ("alias " ~ base.stringof ~ " " ~ name ~ ";"); The disadvantage is, IDEs like IntelliJ are not able to

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Seb via Digitalmars-d-learn
On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote: I am trying to get this code compiled: ```TemplateStore.d module TemplateStore; import std.path; import std.conv; import std.file; [...] You can't read or list files at compile-time. What are you trying to do?

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Seb via Digitalmars-d-learn
On Monday, 11 February 2019 at 01:05:05 UTC, kdevel wrote: On Monday, 11 February 2019 at 00:54:27 UTC, Seb wrote: On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote: [...] You can't read or list files at compile-time. dmd can read files at compile time using the import function [1]

Re: Query for -dip1000

2019-02-11 Thread Seb via Digitalmars-d-learn
On Monday, 11 February 2019 at 09:29:13 UTC, Jonathan M Davis wrote: On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via Digitalmars-d- learn wrote: [...] A quick grep of Phobos shows a version(DIP1000) block in std/typecons.d, which appears to be used to make it so that a particular

Re: Windows Defender won't let me install DMD

2019-02-18 Thread Seb via Digitalmars-d-learn
On Monday, 18 February 2019 at 16:32:26 UTC, belkin wrote: I am trying to install the compiler and get started on learning D again ( attempted and stopped way back ) This is the error message I am getting. I am on Windows 10. Windows Defender SmartScreen prevented an unrecognized app from sta

Re: Disable dub from checking internet before building

2019-02-25 Thread Seb via Digitalmars-d-learn
On Monday, 25 February 2019 at 18:54:03 UTC, Jacob Carlborg wrote: On 2019-02-24 23:51, 0x wrote: How to disable dub from checking internet before building, it's slowing down build whenever it does this. I thought that was fixed [1]. Or is it doing something else? [1] https://dlang.or

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 14:50:45 UTC, Jesse Phillips wrote: I don't know what value it brings with the -i switch existing. Almost none, except that it's twice as slow as DMD because it needs to run DMD twice to learn about all the dependencies. It's only useful for a few small things now:

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 16:45:38 UTC, Seb wrote: On Friday, 1 March 2019 at 14:50:45 UTC, Jesse Phillips wrote: I don't know what value it brings with the -i switch existing. Almost none, except that it's twice as slow as DMD because it needs to run DMD twice to learn about all the depende

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote: On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: [...] In such questions it's important to show your shebang since that's what runs your script. Given your symptoms I guess you'

Re: Phobos in BetterC

2019-03-10 Thread Seb via Digitalmars-d-learn
On Friday, 8 March 2019 at 09:24:25 UTC, Vasyl Teliman wrote: I've tried to use Mallocator in BetterC but it seems it's not available there: https://run.dlang.io/is/pp3HDq This produces a linker error. I'm wondering why Mallocator is not available in this mode (it would be intuitive to assum

Re: Why does D language do not support BigDecimal type?

2019-03-12 Thread Seb via Digitalmars-d-learn
On Monday, 11 March 2019 at 15:23:34 UTC, BoQsc wrote: There is Money datatype that can be provided by using a third party package: https://code.dlang.org/packages/money But that's only for money, what about math? Why such fundamental as BigDecimal is still not included into the D language its

Re: Issues with std.net.curl on Win 10 x64

2019-03-25 Thread Seb via Digitalmars-d-learn
On Monday, 25 March 2019 at 19:02:18 UTC, cptgrok wrote: On Monday, 25 March 2019 at 16:44:12 UTC, Andre Pany wrote: First idea, please switch to x86_64 if possible. This will also be the default of Dub in the next dmd release or the release after. Kind regards Andrew Figured out --arch=x86

Re: CTFE & code generators based on PEG grammars?

2019-04-06 Thread Seb via Digitalmars-d-learn
On Saturday, 6 April 2019 at 12:06:22 UTC, Robert M. Münch wrote: I like the idea of DSL which are transpiled into the target language that gets compiled or are interpreted at run-time. Since D is compiled, I would like to transpile the DSL to D at compile-time. The idea is, that I can write

Re: Iterate/sort associative array by value?

2019-04-07 Thread Seb via Digitalmars-d-learn
On Sunday, 7 April 2019 at 16:44:01 UTC, Robert M. Münch wrote: On 2019-04-07 16:24:52 +, Cym13 said: You could use sort to gather the indexes in order then traverse from there: aa.byKey.array.sort!((a, b) => aa[a] That doesn't work: Error: no property array for type Result With a

Re: Iterate/sort associative array by value?

2019-04-07 Thread Seb via Digitalmars-d-learn
On Sunday, 7 April 2019 at 20:02:15 UTC, Seb wrote: On Sunday, 7 April 2019 at 18:22:00 UTC, Robert M. Münch wrote: On 2019-04-07 17:16:12 +, Seb said: Then you can do: --- ["a": 1].byPair.array.sort!((a, b) => a.value < a.value).release.each!writeln; --- You'll have a sorted array wit

Re: Iterate/sort associative array by value?

2019-04-07 Thread Seb via Digitalmars-d-learn
On Sunday, 7 April 2019 at 18:22:00 UTC, Robert M. Münch wrote: On 2019-04-07 17:16:12 +, Seb said: Then you can do: --- ["a": 1].byPair.array.sort!((a, b) => a.value < a.value).release.each!writeln; --- You'll have a sorted array with key and value props. This seems to be really tric

Re: Iterate/sort associative array by value?

2019-04-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 April 2019 at 08:31:33 UTC, Dennis wrote: On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote: Why does DMD not give a hint, that an import from the standard lib might be missing? I find these explicit import statements very annyoing. There currently are a few hard-cod

Re: Iterate/sort associative array by value?

2019-04-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 April 2019 at 18:04:28 UTC, kdevel wrote: On Sunday, 7 April 2019 at 17:16:12 UTC, Seb wrote: --- ["a": 1].byPair.array.sort!((a, b) => a.value < a.value).release.each!writeln; --- What's the purpose of .release? The documentation in https://dlang.org/phobos/std_range.html#.Sor

Re: Cannot link vibe.d sample / optlink error

2019-04-08 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 06:50:36 UTC, Michal Minich wrote: On Monday, 8 April 2019 at 14:49:02 UTC, Radu wrote: [...] Thank you Radu! Your answer helped and hello word is now running :) After using --verbose I found that I do not have libcmt.lib on my computer at all. Though I have Vis

Re: Overloads not returning appropriate info. [Field reflunkory]

2019-04-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 16:30:53 UTC, Alex wrote: On Tuesday, 9 April 2019 at 14:59:03 UTC, Adam D. Ruppe wrote: [...] I didn't say the language. The point with the language is that it could have built in semantics to do reflection in a inform way(__traits is somewhat uniform but messy and

Re: DRuntime arguments

2019-04-10 Thread Seb via Digitalmars-d-learn
On Wednesday, 10 April 2019 at 12:11:06 UTC, Cym13 wrote: Where can I find a list of all druntime arguments supported? Things like --DRT-covopt='merge:1' or --DRT-gcopt='gc:profile=1' are not easy to guess and I can't find any centralized documentation. There isn't any yet.

Re: Dummy template parameter vs empty template parameter list

2019-04-10 Thread Seb via Digitalmars-d-learn
On Wednesday, 10 April 2019 at 20:37:38 UTC, Ben Jones wrote: Looking through Phobos code there's a bunch functions defined with dummy template types: void whatever(TDummy = void)( int x, ...) //TDummy is never used Why not just use an empty template parameter list? void whatever()(int x, ...

  1   2   3   4   >