Re: using dub and -checkaction=context

2021-01-17 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 17 January 2021 at 15:41:45 UTC, Steven Schveighoffer wrote: I'm trying to run unittests using `dub test`, and I wanted to use the new -checkaction=context feature to avoid having to instrument my unittests to print out the string comparison failure that's happening. But I tried

Re: Why doesn't this work when the function is a static method?

2021-01-14 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 14 January 2021 at 15:20:54 UTC, Jack wrote: On Thursday, 14 January 2021 at 09:13:27 UTC, evilrat wrote: On Thursday, 14 January 2021 at 05:44:43 UTC, Jack wrote: On Wednesday, 13 January 2021 at 17:21:23 UTC, Paul Backus wrote: Member functions (including static ones) can't be

Re: dirEntries: How get "." and ".."?

2021-01-10 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 9 January 2021 at 18:44:10 UTC, kdevel wrote: There seems to be no switch to disable the skip of "." and "..". So the original position of these dir entries is lost. ☹ I imagine dirEntries returning an entry for ".." would make for a lot of confusion. Don't you already know

Re: How can I set Timeout of Socket?

2020-11-15 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 15 November 2020 at 00:05:08 UTC, Marcone wrote: Socket s = new Socket(AddressFamily.INET, SocketType.STREAM); s.connect(new InternetAddress("domain.com", 80)); I want that program raise an error if reach for example 30 seconds of timeout. My program does something like this.

Re: How format UnixTime to "%Hh:%Mm:%Ss" ?

2020-11-15 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 15 November 2020 at 03:14:07 UTC, Marcone wrote: I want to convert seconds to hour, minut and second. Do you want to convert a *duration* into hours/minutes/seconds, or format a UNIX *timestamp* to hours/minutes/seconds? These are conceptually two different things.

Re: How format UnixTime to "%Hh:%Mm:%Ss" ?

2020-11-14 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 15 November 2020 at 03:08:48 UTC, Marcone wrote: On Sunday, 15 November 2020 at 02:29:20 UTC, Anonymouse wrote: On Sunday, 15 November 2020 at 01:04:41 UTC, Marcone wrote: auto mytime = Clock.currTime().toUnixTime() writeln(strftime("%Hh:%Mm:%Ss", mytime)); How can I make some

Re: How format UnixTime to "%Hh:%Mm:%Ss" ?

2020-11-14 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 15 November 2020 at 01:04:41 UTC, Marcone wrote: auto mytime = Clock.currTime().toUnixTime() writeln(strftime("%Hh:%Mm:%Ss", mytime)); How can I make some like this in D? auto mytime = Clock.currTime; writefln("%02dh:%02dm:%02ds", mytime.hour, mytime.minute, mytime.second);

Re: Switch between two structs with csvreader

2020-11-05 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 5 November 2020 at 21:18:52 UTC, Selim Ozel wrote: auto records = rawtext.csvReader!struct_type1(';'); D is statically typed and `auto` means "deduce this type for me based on this one function's return value". It is not like JavaScript's `var` whose type may change. If I'm

Re: I need a most simple and easy example to understand UDA.

2020-11-01 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 1 November 2020 at 20:33:15 UTC, Marcone wrote: I need a most simple and easy example to understand UDA. https://ddili.org/ders/d.en/uda.html

Re: Removind duplicates for JSON string

2020-11-01 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 1 November 2020 at 09:14:35 UTC, Vino wrote: [ Tuple!(string, string)("DEV", "D1"), Tuple!(string, string)("DEV", "default"), Tuple!(string, string)("DEV", "D1"), Tuple!(string, string)("QAS", "Q1"), Tuple!(string, string)("QAS", "Q1"), Tuple!(string, string)("QAS", "default"),

Re: dub fetching dependencies for wrong configuration(s)

2020-10-28 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 28 October 2020 at 19:34:43 UTC, ikod wrote: To make this transition as painless as possible I'll create new package with major version "2" if you confirm that everything works as expected. I tried cloning requests from git and added it as a dub package, and it seems to work.

Re: dub fetching dependencies for wrong configuration(s)

2020-10-27 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 21:15:35 UTC, ikod wrote: On Tuesday, 27 October 2020 at 17:01:23 UTC, Anonymouse wrote: On Sunday, 4 October 2020 at 21:00:49 UTC, ikod wrote: Thanks, Andre! I'll split requests as you suggested (increasing minor version, so that this change will not hurt

Re: dub fetching dependencies for wrong configuration(s)

2020-10-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 4 October 2020 at 21:00:49 UTC, ikod wrote: Thanks, Andre! I'll split requests as you suggested (increasing minor version, so that this change will not hurt anybody who build current requests package for vibe-d). Will you make a requests-core?

Re: How Stop Worker Thread if Owner Thread is Finished?

2020-10-27 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 08:33:36 UTC, Johann Lermer wrote: or you could use the fact, that receiveTimeout throws an exception, when main ends (although I don't know if this is the intended behaviour; the manual just says that it throws an exception when the sending thread was

Re: `unittest` placement in code?

2020-10-26 Thread Anonymouse via Digitalmars-d-learn
On Monday, 26 October 2020 at 13:16:32 UTC, Vladimirs Nordholm wrote: Hello. [...] Additionally, if you care about generating documentation, then placing them after whatever is being tested can make them end up as examples (of how to use them). Handy if your unittests shows how they're used

Re: Docs generation example

2020-10-09 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 10 October 2020 at 02:07:02 UTC, Виталий Фадеев wrote: Wanted! Docs generation example. I have dub project, sources/*.d. I want html-index with all classes/functions. Is exists simple, hi-level, one-line command line solution ? dub run adrdox -- -i sources Files will be in

Re: Taking arguments by value or by reference

2020-10-04 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 3 October 2020 at 23:47:32 UTC, Max Haughton wrote: The guiding principle to your function parameters should be correctness - if I am passing a big struct around, if I want to take ownership of it I probably want to take it by value but if I want to modify it I should take it by

dub fetching dependencies for wrong configuration(s)

2020-10-04 Thread Anonymouse via Digitalmars-d-learn
My project depends on the requests dub package, which has two build configurations; one with an extra vibe-d dependency, one without (default). "configurations": [ { "name": "std" }, { "name": "vibed", "versions": ["vibeD"],

Taking arguments by value or by reference

2020-10-03 Thread Anonymouse via Digitalmars-d-learn
I'm passing structs around (collections of strings) whose .sizeof returns 432. The readme for 2.094.0 includes the following: This release reworks the meaning of in to properly support all those use cases. in parameters will now be passed by reference when optimal, [...] * Otherwise, if

Re: Safe to remove AA elements while iterating over it via .byKeyValue?

2020-09-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 27 September 2020 at 13:02:04 UTC, Per Nordlöw wrote: Is it safe to remove AA-elements from an `aa` I'm iterating over via aa.byKeyValue? I'm currently doing this: foreach (ref kv; aa.byKeyValue) { if (pred(kv.key)) aa.remove(kv.key); // ok? } if

Re: Struct initializer in UDA

2020-09-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 27 September 2020 at 10:17:39 UTC, realhet wrote: On Saturday, 26 September 2020 at 17:13:17 UTC, Anonymouse wrote: On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote: The closest I can get is @(S.init.c(9).f(42)) with use of opDispatch, which is easier to read but still

Re: Struct initializer in UDA

2020-09-26 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote: Hi, struct S{int a, b, c=9, d, e, f;} Is there a way or a trick to declare an UDA by using a nice struct initializer? It would be nice to be able to use the form: @S{f:42} int a; //or something similar to this. instead of

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:08:39 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:14:46 UTC, Paul Backus wrote: You can check the TERM environment variable [2], or you can use the POSIX uname() function [3] to see if you're running under Cygwin specifically. If there are any other environments where you need to manually set

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was stdout.flush(), which I need to call manually for Cygwin terminals and

Re: Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
On Monday, 24 August 2020 at 22:32:52 UTC, Anonymouse wrote: `__traits(allMembers, std.algorithm)` evaluates to nothing, but replace it with `std.algorithm.searching` and it does. `std.algorithm` makes for a bad example as it is actually empty save for imports. Just read it as `std.datetime`

Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
I have some modules, and then one `package.d` file that publicly imports them all. I have reason to access them individually however, with hopes of being able to enumerate them and introspect with `__traits(allMembers, someModule)`. Concretely, I want to express "find all module-level classes

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 16 August 2020 at 10:07:02 UTC, Simen Kjærås wrote: On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: ../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function

Re: My RPN calculator code review?

2020-07-18 Thread Anonymouse via Digitalmars-d-learn
On Friday, 17 July 2020 at 21:37:46 UTC, AB wrote: Hello, inspired by the "Tiny RPN calculator" example seen on the dlang homepage, I wanted to create my own version. I'd appreciate your opinions regarding style, mistakes/code smell/bad practice. Thank you. I generally don't know what I'm

Re: getopt: How does arraySep work?

2020-07-14 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply not the case.

Re: Send empty assoc array to function

2020-07-09 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 9 July 2020 at 19:53:42 UTC, JN wrote: void foo(int[int] bar) { // ... } Is it possible to send an empty array literal? foo( [ 0 : 2 ] ) works foo( [] ) doesn't int[int] empty; foo(empty); works but it's two lines I always did foo((int[int]).init);

Re: std.concurrency.receive and shared const(char)[]?

2020-06-28 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 28 June 2020 at 16:11:50 UTC, BakedPineapple wrote: import std.stdio; import std.concurrency; void main() { auto t = spawn((){ receive((shared const(char)[] char_arr) { ownerTid.send(true); }); }); shared

Re: Dub platform probes

2020-05-25 Thread Anonymouse via Digitalmars-d-learn
On Monday, 25 May 2020 at 22:58:54 UTC, Tim wrote: [...] Same here, but /tmp. $ ls /tmp/dub* | wc -l 174

Re: Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-09 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote: Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } } __traits(isRef, x)

Compilation memory use

2020-05-04 Thread Anonymouse via Digitalmars-d-learn
TL;DR: Is there a way to tell what module or other section of a codebase is eating memory when compiling? I'm keeping track of compilation memory use using zsh `time` with some environmental variables. It typically looks like this. ``` $ time dub build -c dev Performing "debug" build using

Re: Can't get dub dustmite to work

2020-04-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 26 April 2020 at 22:05:20 UTC, aliak wrote: On Saturday, 25 April 2020 at 19:00:55 UTC, Anonymouse wrote: On Saturday, 25 April 2020 at 09:38:59 UTC, aliak wrote: Then I run this dub dustmite command: dub dustmite -b unittest ../dubdust --compiler-regex="never matches" I have

Re: Can't get dub dustmite to work

2020-04-25 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 25 April 2020 at 09:38:59 UTC, aliak wrote: Then I run this dub dustmite command: dub dustmite -b unittest ../dubdust --compiler-regex="never matches" I have had zero luck with dustmite via dub. I would honestly recommend that you create a shell script that does `dub test 2>&1

Re: Bug in std.json or my problem

2020-04-22 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 22 April 2020 at 17:48:18 UTC, Craig Dillabaugh wrote: The crash is caused because the 'income' field with value 0.0 is output as 0 (rather than 0.0) and when it is read this is interpreted as an integer. Shouldn't this work? Yes, it's just buggy. Giving it a value of an even

Re: docs.json is incomplete

2020-04-11 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 11 April 2020 at 13:13:45 UTC, Adam D. Ruppe wrote: On Saturday, 11 April 2020 at 06:49:21 UTC, Anonymouse wrote: (TL;DR: the module contains one public class and (private) two structs, three free functions and one module-level mixin, but only the class is shown. It is all under

docs.json is incomplete

2020-04-11 Thread Anonymouse via Digitalmars-d-learn
I'm trying to get docs for my project hosted, and everything works, except there are entries missing. Looking at the generated docs.json there's simply a lot of omitted stuff. Example: http://kameloso.dpldocs.info/kameloso.plugins.sedreplace.html

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:53:03 UTC, jmh530 wrote: Well that definitely shouldn't happen. I would file a bug report. Filed as https://issues.dlang.org/show_bug.cgi?id=20726

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:22:11 UTC, jmh530 wrote: On Wednesday, 8 April 2020 at 18:50:16 UTC, data pulverizer wrote: On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote: ``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); }

@safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } void main() { foo(); } ``` This currently works; `foo` is `@safe` and prints the value of `gshared`. Changing the call in main to `foo(gshared)` errors. Should it work, and can I

dub sourceFiles

2020-03-31 Thread Anonymouse via Digitalmars-d-learn
I have a library package that I split up into subpackages, but I'm having to do mental gymnastics to make it only compile the files I want. The problem is that even if you specify some `sourceFiles`, it will build everything under the sun inside `sourcePaths`, which defaults to "source" or

Re: How to create an array with custom length?

2020-03-27 Thread Anonymouse via Digitalmars-d-learn
On Friday, 27 March 2020 at 19:30:39 UTC, Quantium wrote: Code int n=0; readf(" %d", ); int[n] m; generated an error (DMD compiler): Cannot read n at compile time. How to create an array with custom length? The tour has a page for this: https://tour.dlang.org/tour/en/basics/arrays

Re: dub and -lowmem: does nothing

2020-03-21 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 21 March 2020 at 00:17:37 UTC, kinke wrote: Most likely because dub doesn't actually invoke the listed command, but uses a response file to work around cmdline length limits. -lowmem in response files is ignored by DMD (needs to be parsed and set before druntime initialization,

dub and -lowmem: does nothing

2020-03-20 Thread Anonymouse via Digitalmars-d-learn
Manjaro/Arch x86_64, dmd v2.091.0, dub 1.19.0. I have a project which dmd on Windows fails to compile, throwing an OutOfMemoryError[1]. Up until recently it could be worked around by using `--build-mode=singleFile`, but now that's no longer enough and errors out too (on AppVeyor). The

Re: How to get to body of HTTP 500 error with std.net.curl.get()?

2020-02-16 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 16 February 2020 at 09:13:54 UTC, ikod wrote: Just a note - this is not a bug, server really send empty body: < HTTP/1.1 500 Internal Server Error < cache-control: private < server: Microsoft-IIS/10.0 < x-aspnetmvc-version: 5.1 < access-control-allow-origin: * < x-aspnet-version:

Re: How to get to body of HTTP 500 error with std.net.curl.get()?

2020-02-15 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 15 February 2020 at 16:25:42 UTC, Gregor Mückl wrote: Unfortunately, this is not true. The msg only contains the text information in the status line of the HTTP reply. If I'm not mistaken, the exception is created in this line in std/net/curl.d: enforce(statusLine.code / 100

Re: Overfflow in Assert error messages

2020-02-13 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 13 February 2020 at 07:49:13 UTC, Adnan wrote: However my test fails saying something like: source/binary_search.d(33): [unittest] 18446744073709551615 != 1 core.exception.AssertError@source/binary_search.d(33): 18446744073709551615 != 1 What's causing this underflow? It's

Re: Some impressions/notes from a new D programmer

2020-02-12 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 13:36:13 UTC, mark wrote: Some cargo packages are applications. If I do 'cargo install someapp' it will be installed in $HOME/.cargo/bin. So by simply adding that to my PATH, I can easily use all installed rust apps. But dub doesn't appear to have an

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:08:50 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 22:01:18 UTC, Anonymouse wrote: No, C:\Temp\work\dl\git does not exist. :o OK, that makes sense. Please try the latest Digger version (24cd4168956dad382d05984b4b8d37d9e8ebe3ae). Works

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:58:31 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:44:20 UTC, Anonymouse wrote: New log: https://pastebin.com/raw/uUMNQjEN It looks like it fails to execute git (to get the current version for the build). I don't know why that fails, as I

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:33:09 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:30:57 UTC, Anonymouse wrote: I was on beta 8. I forced dub to download the latest now (3.0.0-alpha-9), wiped the work directory and retried, but to similar results. The latest is

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:54:46 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Is your Digger version up-to-date?

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:09:43 UTC, MoonlightSentinel wrote: On Monday, 3 February 2020 at 16:54:20 UTC, Anonymouse wrote: It does a `dmd.exe -of..\generated\build.exe`, but then the immediately following call to `..\generated\build.exe` fails? What am I doing wrong? The executable

digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
I'm trying to bisect a dmd compilation error on Windows 10 and I can't get digger to do more than one initial test. When preparing to compile the next dmd build (the BAD revision) it errors out. This is in a normal cmd console. The bisect ini has nothing weird in it: ``` bad = v2.088.1 good

Re: list of all defined items in a D file

2020-01-23 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 23 January 2020 at 17:10:29 UTC, berni44 wrote: I'd like to get a list of all items (public, package, private) that are defined in a D file. Is there a simple way, to get them? __traits(allMembers, mixin(__MODULE__))? Replace with a full module name if not the current one.

Re: How to Unqual an array?

2019-11-16 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 November 2019 at 15:20:26 UTC, James Blachly wrote: On 11/16/19 9:48 AM, James Blachly wrote: I am trying to write templated code that will take a character array -- mutable, const, or immutable (string). I am aware of isSomeString, but I am still curious about Unqual array

Re: Inspecting __traits(isDeprecated) and deprecation warnings

2019-09-26 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 25 September 2019 at 20:35:55 UTC, Boris Carvajal wrote: On Wednesday, 25 September 2019 at 14:20:00 UTC, Anonymouse wrote: I added some deprecations in my project and am going through my templates trying to silence the warnings that suddenly popped up. This template works, but

Re: Inspecting __traits(isDeprecated) and deprecation warnings

2019-09-25 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 25 September 2019 at 05:57:19 UTC, Tobias Pankrath wrote: Does your code work or does it not? I don't seem to unterstand neither what the question here is nor what the desired result is. Is the problem that the static reflections triggers the deprecation warning? I added some

Inspecting __traits(isDeprecated) and deprecation warnings

2019-09-24 Thread Anonymouse via Digitalmars-d-learn
I want to write a piece of code that reflects on the names of members of a passed struct, where some are depreacted. https://run.dlang.io/is/P9EtRG struct Foo { string s; int ii; bool bbb; deprecated("Use `s`") string ; } template longestMemberLength(T) { enum

Re: Deprecation message sources

2019-09-17 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 17 September 2019 at 19:31:53 UTC, Steven Schveighoffer wrote: I'd hate to say the answer is to special case Nullable for so many functions, but what other alternative is there? -Steve Nullable isn't alone, std.json.JSONType causes a literal wall of text of deprecation warnings.

Interdependent dub subpackages

2019-08-30 Thread Anonymouse via Digitalmars-d-learn
I have a project where the source is mixed library, mixed application, and I'd like to separate the two. The code is fairly decoupled as is, but the files are all next to each other in the same namespace. I moved out the library parts and made a new dub package, and it alone compiles fine.

Re: Use std.string.lineSplitter with std.array.Appender!string

2019-08-28 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 15:52:18 UTC, NonNull wrote: Disambiguate how ? ``` import std.string, std.array; auto s = appender!string; // ... auto a = s.lineSplitter; ``` auto a = s.data.lineSplitter; On mobile, can't test.

Re: How to check that import module will succeed?

2019-07-26 Thread Anonymouse via Digitalmars-d-learn
On Friday, 26 July 2019 at 06:24:18 UTC, evilrat wrote: On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote: bool isModuleAvailable(alias modName)() { mixin("import " ~ modName ~ ";"); static if (__traits(compiles, mixin(modName).stringof)) return true;

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-17 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 17 July 2019 at 17:43:53 UTC, Anonymouse wrote: [...] Ignore this, Logger is a class and the error is to be expected. Will retry dustmite.

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-17 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 July 2019 at 13:33:01 UTC, Anonymouse wrote: I started a dustmite process, with some luck it should produce something smaller by tonight or tomorrow. Reduced: import std.experimental.logger : Logger; void main() { Logger logger; logger.error(); } git clone

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 July 2019 at 13:33:01 UTC, Anonymouse wrote: IRCParser.init.chantypes even has a default value of "#". IRCParser.init.client.server.chantypes.

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 July 2019 at 11:20:49 UTC, Boris Carvajal wrote: The debugger exposes a crash in memchr from C runtime. In file messaging.d line 216 called from the unittest just below if (emoteTarget.beginsWithOneOf(state.client.server.chantypes)) chantypes.ptr is null. However

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-16 Thread Anonymouse via Digitalmars-d-learn
On Monday, 15 July 2019 at 12:40:57 UTC, Boris Carvajal wrote: On Monday, 15 July 2019 at 11:48:13 UTC, Anonymouse wrote: I built it with: dub fetch digger dub run digger -- build "stable + druntime#2675" I have not touched any digger.ini. The only one I can find is digger.ini.sample.

Re: OPTLINK : Warning 9: Unknown Option : OUT

2019-07-15 Thread Anonymouse via Digitalmars-d-learn
On Monday, 15 July 2019 at 11:12:41 UTC, Vladimir Panteleev wrote: On Monday, 15 July 2019 at 10:27:49 UTC, Anonymouse wrote: OPTLINK : Warning 9: Unknown Option : OUT It looks like it's trying to use MS link command-line syntax with DM OPTLINK. I'm not sure why that would happen, as

OPTLINK : Warning 9: Unknown Option : OUT

2019-07-15 Thread Anonymouse via Digitalmars-d-learn
I wanted to try out druntime + a specific pull request with digger on Windows, and dmd and everything builds, except my program itself fails to link when compiled with it. $ dub test --compiler=C:/cygwin/home/zorael/work/result/bin/dmd.exe [...] Linking... OPTLINK (R) for Win32 Release

Re: Windows segfault, need brief help

2019-07-15 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 14 July 2019 at 08:49:43 UTC, Boris Carvajal wrote: On Saturday, 13 July 2019 at 16:39:51 UTC, Anonymouse wrote: Thank you! Filed as https://issues.dlang.org/show_bug.cgi?id=20048. https://github.com/dlang/druntime/pull/2675 Excellent, thanks! I got OPTLINK errors while trying

Re: Windows segfault, need brief help

2019-07-13 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 13 July 2019 at 06:36:06 UTC, Boris Carvajal wrote: On Friday, 12 July 2019 at 22:46:11 UTC, Anonymouse wrote: I'm suddenly getting segfaults when running tests on Windows. It works fine on Linux. I reduced it to a few lines (plus a dependency) with dustmite, but they don't really

Re: Windows segfault, need brief help

2019-07-13 Thread Anonymouse via Digitalmars-d-learn
On Friday, 12 July 2019 at 23:05:41 UTC, Stefan Koch wrote: [1]: https://github.com/zorael/tests/blob/wintestcrash/source/app.dx maybe you haven't pushed? I can't see it. Sorry, typo in the link. https://github.com/zorael/tests/blob/wintestcrash/source/app.d

Windows segfault, need brief help

2019-07-12 Thread Anonymouse via Digitalmars-d-learn
I'm suddenly getting segfaults when running tests on Windows. It works fine on Linux. I reduced it to a few lines (plus a dependency) with dustmite, but they don't really make sense[1]. Nevertheless they do trigger the segfault. Can someone with Windows 10 and dmd 2.087.0 try the following

Closures and memory allocation

2019-06-22 Thread Anonymouse via Digitalmars-d-learn
I'm looking into why my thing does so many memory allocations. Profiling with kcachegrind shows _d_allocmemory being called upon entering a certain function, lots and lots of times. It's a function that receives concurrency messages, so it contains nested functions that close over local

Re: Delegate / Error: cannot implicitly convert expression...

2019-06-15 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 15 June 2019 at 15:54:00 UTC, Robert M. Münch wrote: Why does the follwing code give: Error: cannot implicitly convert expression & myFunc of type void function(int a) to void delegate(int) void myFunc(int a){return;} void main() { void delegate(int) dg; dg = } See:

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread Anonymouse via Digitalmars-d-learn
On Monday, 10 June 2019 at 08:02:18 UTC, vitalfadeev wrote: On Monday, 10 June 2019 at 07:45:42 UTC, vitalfadeev wrote: On Monday, 10 June 2019 at 07:41:40 UTC, vitalfadeev wrote: How to? I plan scan First array with checkers: [checker, checker, checker] ...and store result to Second array:

Re: 'version'-based code selection

2019-06-02 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 1 June 2019 at 07:46:40 UTC, Jonathan M Davis wrote: For the most part though, you don't declare your own version identifiers. It sometimes makes sense, but usually, version identifiers are used for versioning code based on the platform or architecture that it's compiled on.

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn
On Friday, 31 May 2019 at 13:50:57 UTC, Andre Pany wrote: You can specify the parameters also in code. See example here https://dlang.org/changelog/2.085.0.html#gc_cleanup I need it to apply to dmd though, I'm exceeding memory limits when compiling. Once done the program doesn't need a whole

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn
On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: $ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ], This should work indeed. I guess it doesn't because dub probably uses a response file containing all

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: What is the correct way? --DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By

[dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn
I'm trying to tweak the GC when compiling with dub, starting with something easy like profile:1. $ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ], $ dub test Doesn't work, doesn't give any extra output. Entering bogus flags like --DRT-gcopt=banana:1 doesn't evoke

Re: Tweakig -lowmem to be more eager

2019-05-21 Thread Anonymouse via Digitalmars-d-learn
On Monday, 20 May 2019 at 13:41:15 UTC, Boris-Barboris wrote: On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote: What makes it decide to collect? What triggers it? You can try setting heapSizeFactor option to something lower than 2 to increase collection frequency:

Re: Tweakig -lowmem to be more eager

2019-05-19 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote: Tweakig I'd edit the title if I could. Grumble mutter.

Tweakig -lowmem to be more eager

2019-05-19 Thread Anonymouse via Digitalmars-d-learn
I have CircleCI set up to test my project when I push to GitHub. For a free user there the memory restriction is pretty severe (4 Gb), and as such non-trivial programs cannot be compiled without separate compilation. This sounded like a clear-cut case for -lowmem, but the process is still

Re: Nothing at all compiles with -m64 on Windows

2019-05-11 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 7 May 2019 at 17:33:22 UTC, Ron Tarrant wrote: I've had this happen, too. I don't know for sure, but I think it may be because the installers aren't prepared to do updates, not on Windows, anyway. My best success for updating has been to scrape D completely off my drive (ie.

Nothing at all compiles with -m64 on Windows

2019-05-07 Thread Anonymouse via Digitalmars-d-learn
Everything, even an empty void main, fails to compile in -m64 on this machine running Windows. -m32 works. dmd was installed with the .exe installer. It used to work and I forget what version of dmd I had, but then I upgraded to 2.086 and now it doesn't. I've tried reverting as far back as

Setting process name

2019-05-01 Thread Anonymouse via Digitalmars-d-learn
Is there a way of setting the process/thread name that's neater than this? import core.sys.posix.pthread; extern(C) int pthread_setname_np(pthread_t, const char*); void main() { import std.string : toStringz; pthread_setname_np(pthread_self(), toStringz("thread_name")); // ... }

Re: Trying to extract string from curl redirected URL

2019-02-10 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 10 February 2019 at 14:12:02 UTC, Josh wrote: Is there something I'm missing? It it possible to access the private handle? Is there a better way to do what I'm trying to achieve? Assuming I'm understanding your question (you want to get the path of a URL after redirects), if

Re: Generating API documention

2019-01-10 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 10 January 2019 at 08:50:27 UTC, Anonymouse wrote: Then just dub build -ddox Naturally dub build -b ddox.

Re: Generating API documention

2019-01-10 Thread Anonymouse 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

Reverse JSON toPrettyString

2018-12-17 Thread Anonymouse via Digitalmars-d-learn
I have a JSON string[][string] associative array object that I want to take the .toPrettyString value of. However, it sorts the output alphabetically. string[][string] aa = [ "abc" : [], "def" : [], "ghi" : [] ]; auto asJSON = JSONValue(aa); writeln(asJSON.toPrettyString); Output: {

Re: ddox and exempting dependencies

2018-12-05 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 5 December 2018 at 16:56:12 UTC, Andre Pany wrote: The compiler (DMD) is triggered to generate a JSON file docs.json which contains technical information used by ddox in a later step. The error message you see is thrown by dmd. At this point of time, ddoxFilterArgs isn't

ddox and exempting dependencies

2018-12-05 Thread Anonymouse via Digitalmars-d-learn
As far as I understand you use dub.json "-ddoxFilterArgs": [ "--ex", "pattern" ] to make ddox exclude files from the documentation it generates. However, it still parses, warns and errors out on dependencies, even if they're set up to be exempted. 1. $ dub init [...] Add dependency (leave

Non-blocking reads of a fifo (named pipe)?

2018-12-03 Thread Anonymouse via Digitalmars-d-learn
I have a fifo that I want to read lines from, but everything is blocking. execute([ "mkfifo", filename ]); File fifo = File(filename, "r"); // blocks already immutable input = fifo.readln(); // blocks foreach (line; fifo.byLineCopy) { /* blocks */ } How can I go about doing this to get

Re: How to get all modules in a package at CT?

2018-11-24 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote: I have a package named command, and many modules inside it, such as command.build, command.pack, command.help... I want to get all these modules at compile time so that I know what command is available. If you just want static if

  1   2   >