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"],

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 re

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 gener

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: 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 terminated)

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: 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 anybod

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: 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: 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: 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 not

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); auto

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 like

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. `Clock.currTim

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. (unte

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: 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: 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 ad

Re: How to profile compile times of a source code?

2021-01-31 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:31:59 UTC, Johan Engelen wrote: Try LDC 1.25 (now in beta testing) with --ftime-trace. Clang has the same option, so you can read more about it online in that context. Be sure to check out the related commandline flags. I recommend the Tracy UI to look at traces

Re: std.net.curl and HTTP.responseHeaders

2021-02-04 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 19:25:18 UTC, Vindex wrote: Output: ``` std.net.curl.HTTPStatusException@/usr/include/dmd/phobos/std/net/curl.d(1097): HTTP request returned status code 405 () ``` Perhaps some special HTTP configuration is needed? Is this closer to what you want? import std.

Re: is it posible to compile individual module separately?

2021-02-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:06:21 UTC, evilrat wrote: On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote: i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe third party tool? alternative to dub? Assuming y

Re: is it posible to compile individual module separately?

2021-02-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 17:26:06 UTC, Paul Backus wrote: On Tuesday, 16 February 2021 at 17:15:25 UTC, Anonymouse wrote: You can also use dub build --build-mode=singleFile, and it will compile one file at a time. It'll be slow but slow is better than OOM. singleFile is for single-file

Re: is it posible to compile individual module separately?

2021-02-17 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 18:54:08 UTC, Paul Backus wrote: I stand corrected. Shouldn't have trusted the documentation so much, I guess. It makes perfect sense to intuit that --single should be related to --build-mode=singleFile. As it is the build modes aren't explained in the document

Re: Creating std.format.format warpper

2021-05-01 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 1 May 2021 at 09:10:09 UTC, novice2 wrote: Hello. Can please anybody help me create template format2 like std.format.format, so it can access to format string (change it for example) then instantiate std.format.format template in compile-time-checkable way Since `std.format.for

Re: String "dequote" in phobos?

2021-05-13 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 13 May 2021 at 14:10:08 UTC, cc wrote: Does something to dequote (unquote? or what would you call it?) a string exist in the standard library? I didn't see one in std.string, just wondering before reinventing the wheel. Something like: ```d assert(dequote(`"foo"`) == "foo"); asse

[dub] Error: module `main` from file source\main.d is specified twice on the command line

2018-06-22 Thread Anonymouse via Digitalmars-d-learn
I'm trying to set up AppVeyor to build and test my project. After some dancing to get a 64-bit dmd.exe in there (which should really be included in the 7z in 2018) everything seems like it should work, but compiling with dub build fails. dub test works but claims that it's excluding main.d twi

Re: [dub] Error: module `main` from file source\main.d is specified twice on the command line

2018-06-23 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 23 June 2018 at 08:10:08 UTC, Jacob Carlborg wrote: On 2018-06-22 21:41, Anonymouse wrote: What can I do? It might be this issue [1], should be fixed in the latest version of Dub. [1] https://github.com/dlang/dub/issues/1454 Thanks.

template alias that includes a parameter

2018-06-30 Thread Anonymouse via Digitalmars-d-learn
I have a template that I want to provide easy aliases for, where the aliases includes (partially applies?) a template parameter. void fooImpl(char token, T)(const T line) { // ... } alias quoteFoo(T) = fooImpl!('"', T); alias singlequoteFoo(T) = fooImpl!('\'', T); void main() { quoteF

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

-allinst and linker errors

2018-07-25 Thread Anonymouse via Digitalmars-d-learn
I'm trying to build my project with -allinst, after reading the comments of issue 18026[1]. Manjaro/Arch 64-bit, dmd 2.081.1 and ldc 1.0.0. I get a wall of text with linker errors, both with dmd and ldc. Demangled excerpt: characterencodings.o: In function `pure nothrow @nogc @safe void st

Variadic template with template arguments in pairs

2018-09-12 Thread Anonymouse via Digitalmars-d-learn
I'm trying to create a variadic template function that takes pairs of arguments. Sort of like getopt, I want to pass any number of pairs of a string and some pointer. Or any size chunk larger than one. Something like the following, assuming the existence of a hypothetical template pairwise:

Re: Variadic template with template arguments in pairs

2018-09-15 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 21:33:17 UTC, Paul Backus wrote: Another alternative is to write the function recursively: void doByPair(T, Rest...)(string desc, T* valuePtr, Rest rest) { writefln("%s %s: %s", T.stringof, desc, *valuePtr); if (rest.length) doByPair(rest); } Rest...

Getting started with separate compilation

2018-09-15 Thread Anonymouse via Digitalmars-d-learn
My project [1] has enough language coverage to expose two issues that break compilation. 1. Stack overflow in ddmd/dtemplate.d:6241, TemplateInstance::needsCodegen(); https://issues.dlang.org/show_bug.cgi?id=18026 2. -allinst gives undefined reference linker errors; https://issues.dlang.org/s

Re: Template/mixin ideas?

2018-10-05 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 11:01:53 UTC, Chris Katko wrote: I've got this simple task but I'm trying to perfect it as best I can to learn something in the process. I have Linux terminal ASCII codes for coloring terminal output. string red(string) { /* ... */ } "Hello world".red => "\033[

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 exp

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 non-bl

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 emp

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 evaluated

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: { "abc"

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 li

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: 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 you're

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")); // ... } I

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 2.07

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. unins

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 ki

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.

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: https://github.com/

[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 a

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 defau

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 cmdl

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: '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. They'r

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: 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 = &myFunc; } S

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 variab

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 and

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

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-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

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 8.00.

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 Digger

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. sc.i

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 chantypes.le

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-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 https://git

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: 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: 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.

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. Id

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.

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 long

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 de

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 it

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 fr

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. You'll

Re: problem with gc?

2015-05-27 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 08:42:01 UTC, zhmt wrote: When I enable the --profle, get something like this, it doesnt give me too much help: [...] Tried callgrind and kcachegrind? If nothing else it's better at illustrating the same output, assuming you have graphviz/dot installed. Given -

Re: problem with gc?

2015-05-27 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 10:24:59 UTC, zhmt wrote: @Anonymouse Thank u very much, I have tried this: valgrind --tool=callgrind ./gamelibdtest callgrind_annotate callgrind.out.29234 Ir file:functio

Re: Utf8 to Utf32 cast cost

2015-06-08 Thread Anonymouse via Digitalmars-d-learn
On Monday, 8 June 2015 at 11:44:47 UTC, Daniel Kozák wrote: No difference even with GC.disable() results are same. Profile! Callgrind is your friend~

Re: Utf8 to Utf32 cast cost

2015-06-08 Thread Anonymouse via Digitalmars-d-learn
On Monday, 8 June 2015 at 18:48:17 UTC, Daniel Kozak wrote: Yep, but I dont care, I am the one who makes transcode faster, so I am happy with results :P. P.S. I care and probably when I have some spare time I will improve to!dstring too Ah, so you are. I confused you with Kadir Erdem Demir.

Re: Error with associative array initializer DMD32 D Compiler v2.070.0

2016-03-03 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 3 March 2016 at 10:01:47 UTC, MGW wrote: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; ... Error: non-constant expression ["foo":5L, "bar":10L, "baz":2000L] I'm not sure there's a way around this except by initialising it at runtime. So you can't get

Re: Iterating over thread local storage variables

2016-03-11 Thread Anonymouse via Digitalmars-d-learn
On Friday, 11 March 2016 at 15:21:38 UTC, maik klein wrote: static Singleton!T get() { if (!instantiated_) { synchronized(Singleton!T.classinfo){ if (!instance_){ instance_ = new Singleton!T(); }

Re: Iterating over thread local storage variables

2016-03-11 Thread Anonymouse via Digitalmars-d-learn
On Friday, 11 March 2016 at 17:33:43 UTC, sigod wrote: On Friday, 11 March 2016 at 17:03:38 UTC, Anonymouse wrote: On Friday, 11 March 2016 at 15:21:38 UTC, maik klein wrote: static Singleton!T get() { if (!instantiated_) { synchronized(Singleton!T.classi

Re: Is there a sorted map?

2016-03-13 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:44:35 UTC, cym13 wrote: Note that implementing an (admitedly not perfect) ordered associative array yourself really isn't much work: https://github.com/cym13/miscD/blob/master/ordered_aa.d Unsigned integer comparison with -1 in the remove function, by the way. :

Re: size_t index=-1;

2016-03-18 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 21:49:05 UTC, Steven Schveighoffer wrote: No, please don't. Assigning a signed value to an unsigned (and vice versa) is very useful, and there is no good reason to break this. -Steve I agree, but implicitly allowing for comparisons between the two allows for e

Re: Checking if a port is listening

2016-03-19 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:44:12 UTC, Lucien wrote: Hello, I want to know if a port of an ip address is listening, actually, I've this : http://pastebin.com/pZhm0ujy (checking port 22/ssh) It works, but it took me ~10min to scan 30 addresses. How can reduce the expiration delay ? I

Re: immutable array in constructor

2016-03-19 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 17 March 2016 at 09:57:37 UTC, Jeff Thompson wrote: In the following code, I explicitly declare array as immutable. But it compiles with the error shown below in the comment. The array object is declared immutable, so how can the compiler say it is a mutable object? In summary, how

Re: Checking if a port is listening

2016-03-20 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 17 March 2016 at 10:41:55 UTC, Marc Schütz wrote: On Wednesday, 16 March 2016 at 22:22:15 UTC, Anonymouse wrote: import core.thread; // for .seconds Nitpick: `seconds` is defined in `core.time`; `core.thread` just reexports it. s.setOption(SocketOptionLevel.SOCKET, SNDTIMEO,

Re: Possible bug in RVO?

2016-04-04 Thread Anonymouse via Digitalmars-d-learn
On Monday, 4 April 2016 at 03:55:26 UTC, Yuxuan Shui wrote: On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote: auto clobber(ref Set x, ref Set o) { Set ret; ret.aa = x.aa; assert(x.aa.length > 0); // <-- boom return ret; } No idea myself but that's

Re: Using a macro for a function signature

2016-04-05 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 11:35:24 UTC, pineapple wrote: If I have a common function signature I'm using throughout my code, and I feel like there should be a way to condense it using a macro. The intuitive method isn't working, but this seems like something D would be able to do. What've I g

Re: Internal compiler erorr

2016-04-15 Thread Anonymouse via Digitalmars-d-learn
On Friday, 15 April 2016 at 16:53:27 UTC, Eric wrote: On Monday, 11 April 2016 at 00:55:44 UTC, Mike Parker wrote: I don't see this specific error in bugzilla. Unfortunately I am getting this error in a large module that has "const string" all over. So I can't come up with a simple test case.

Re: Dealing with type information loss in Parameters Fields and Return type

2016-04-17 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 17 April 2016 at 10:12:29 UTC, Nicholas Wilson wrote: So currently there is a loss of information when Parameters Fields and Return type. i.e. assuming 64 bits size_t foo(ptrdiff_t) {}; writeln(ReturnType!foo); // prints ulong Is there any way to get the types as (tuples of) strings

Re: Dealing with type information loss in Parameters Fields and Return type

2016-04-17 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 17 April 2016 at 10:27:10 UTC, Nicholas Wilson wrote: On Sunday, 17 April 2016 at 10:22:00 UTC, Anonymouse wrote: On Sunday, 17 April 2016 at 10:12:29 UTC, Nicholas Wilson wrote: So currently there is a loss of information when Parameters Fields and Return type. i.e. assuming 64 bit

Re: Accessing __FILE__ and __LINE__ of caller in combination with varargs?

2016-04-17 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 April 2016 at 12:37:46 UTC, Simen Kjaeraas wrote: On Saturday, 16 April 2016 at 00:03:59 UTC, Jonathan M Davis wrote: On Friday, April 15, 2016 20:52:42 WebFreak001 via Digitalmars-d-learn wrote: void assertf(string file = __FILE__, size_t line = __LINE__, Args...)(lazy bool c

Re: Enabling Only Top-Level Unittests

2016-04-21 Thread Anonymouse via Digitalmars-d-learn
On Monday, 21 March 2016 at 10:29:36 UTC, Nordlöw wrote: I want to enable unittests only at the top-level of a module compilation. If I have a module top.d that imports dep1.d dep2.d ... which all contain unittests, how do I compile top.d with only the unittests for top.d e

Re: Why I can't pass to datetime.benchmark function with parameters?

2016-04-23 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 23 April 2016 at 15:11:13 UTC, Suliman wrote: Working: void main() { auto r = benchmark!(foo)(1); } [...] Do not working: void main() { auto r = benchmark!(foo())(1); } [...] Error: expression foo() is void and has no value Do not working: void main() { auto r = benchma

Re: Using a string generated at compile-time in a @nogc function

2016-05-01 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 1 May 2016 at 05:28:36 UTC, Mithun Hunsur wrote: Hi all, I'm working on removing the string mixins from my code, but have run into an issue: http://dpaste.dzfl.pl/ecd7eb53947e As far as I can tell, this should work; the enum should force compile-time execution (which it does, as

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 06:44:36 UTC, rempas wrote: This will not do for me because I want to do formatted output and I need the index. But thanks a lot for tying to help! I'm not certain I understand, but won't `foreach (i, a; args) { /* ... */ }` in his example do that? As in, if y

ldc2 failed with exit code -1073741819.

2022-01-18 Thread Anonymouse via Digitalmars-d-learn
I did a big sweep through my project and changed all `writefln`s and `format`s and the such to take their format patterns as compile-time parameters, and now ldc can no longer build it on Windows. It works on linux, and dmd has no problems with it. There is no error message beyond "failed with

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 16:43:52 UTC, H. S. Teoh wrote: What's the dustmite command you used? In such cases, it's useful to check for this specific error message in your dustmite command, so that it doesn't reduce it past the actual problem case. T Yes, but the only thing I have to

<    1   2   3   >