std.net.curl and HTTP.responseHeaders

2021-02-03 Thread Vindex via Digitalmars-d-learn
Header requests to Wikipedia give 405 error for some reason. ``` import std.stdio, std.net.curl; void main() { auto url = "https://en.wikipedia.org/wiki/Passenger_pigeon;; auto http = HTTP(); options(url, http); writeln(http.responseHeaders); } ``` Output: ```

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 15:59:28 UTC, H. S. Teoh wrote: On Wed, Feb 03, 2021 at 03:47:34PM +, Imperatorn via Digitalmars-d-learn wrote: On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote: > [...] [...] Or dustmite?

GC.addRange multiple times

2021-02-03 Thread vitamin via Digitalmars-d-learn
Is it valid if I call GC.addRange with same or overlaping range? Example: https://run.dlang.io/is/a5a0Ag import core.memory; import std.experimental.allocator.mallocator; import core.lifetime; class Bar{ } struct Foo{ Bar bar; this(Bar bar){ this.bar = bar; } } void

My simple internet client made in Dlang.

2021-02-03 Thread Marcone via Digitalmars-d-learn
I study Dlang for just over a year only and have already risked creating a program even with a graphical interface and distribute it on the internet. Here is a part of that program, just the code without a graphical interface. It is a program for modifying http headers. You connect your

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 03, 2021 at 03:47:34PM +, Imperatorn via Digitalmars-d-learn wrote: > On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote: > > I am dealing with some nasty issue in my code. Basically random > > unrelated lines of code are crashing with access violations, and if > > I switch

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 03, 2021 at 02:00:23PM +, JN via Digitalmars-d-learn wrote: > I am dealing with some nasty issue in my code. Basically random > unrelated lines of code are crashing with access violations, and if I > switch from dmd to ldc the crash goes away, or crash comes back, or it > crashes

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote: I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot.

Any tools to track heap/stack corruptions?

2021-02-03 Thread JN via Digitalmars-d-learn
I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot. Seems like I am corrupting some memory somewhere (I interact

Re: Refactoring tools

2021-02-03 Thread JN via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 07:20:06 UTC, Imperatorn wrote: 2. If not, why? (Is D still too small?) D uses templates and a lot of code is generated at compile time. It's the same reason C++ doesn't have any advanced refactoring tools like e.g. Java does. In Java, it's simple to rename a

Re: Minimize GC memory footprint

2021-02-03 Thread frame via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:14:53 UTC, Imperatorn wrote: It says experimental, but it's fine: https://dlang.org/phobos/std_experimental_allocator.html Well, this looks very nice but I have to deal with GC as long I want to use other libraries that are relying on it or even just

Re: core.atomic for ldc.

2021-02-03 Thread rm via Digitalmars-d-learn
It look like atomicFetchAdd a atomicFetchSub was added to ldc 8 days ago and my distro has old version. I replace core.internal.atomic with this https://raw.githubusercontent.com/ldc-developers/druntime/ldc/src/core/internal/atomic.d and now everything works. It's not even in the latest

Re: Can change vtbl record at runtime ?

2021-02-03 Thread Виталий Фадеев via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 10:20:44 UTC, evilrat wrote: On Wednesday, 3 February 2021 at 08:26:05 UTC, Max Haughton wrote: On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Possible to change the vtbl record at runtime ? Has functional for update vtbl records ? Do

Re: Can change vtbl record at runtime ?

2021-02-03 Thread Виталий Фадеев via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 08:26:05 UTC, Max Haughton wrote: On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Do you mean "Can I set onSuccess" at runtime? Yes.

Re: Can change vtbl record at runtime ?

2021-02-03 Thread frame via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Reason: Reuse component, bind custom callback without creating new class. Concept example: class SaveFilePopup { void onSuccess() { /* default operations */ } } auto saveFile = new

Re: Can change vtbl record at runtime ?

2021-02-03 Thread evilrat via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 08:26:05 UTC, Max Haughton wrote: On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Possible to change the vtbl record at runtime ? Has functional for update vtbl records ? Do you mean "Can I set onSuccess" at runtime? The virtual tables

Re: Can change vtbl record at runtime ?

2021-02-03 Thread Max Haughton via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Reason: Reuse component, bind custom callback without creating new class. Concept example: class SaveFilePopup { void onSuccess() { /* default operations */ } } auto saveFile = new

Re: Refactoring tools

2021-02-03 Thread Max Haughton via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 07:20:06 UTC, Imperatorn wrote: As the title says: 1. Are there any (automated) refactoring tools for D? 2. If not, why? (Is D still too small?) D is also designed to not need as much refactoring as other languages, so even for our size there isn't a huge