Re: POST request with std.net.curl

2021-07-23 Thread frame via Digitalmars-d-learn
On Friday, 23 July 2021 at 21:25:01 UTC, bachmeier wrote: Authorization is working - it's the same whether I'm doing a GET or POST request. The problem is passing the data. The main problem is that the documentation doesn't explain how to translate a `--data` option into a `post` call. I've tr

Re: Destructors can't be @nogc?

2021-07-23 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 24 July 2021 at 02:02:00 UTC, Mike Parker wrote: On Friday, 23 July 2021 at 20:24:02 UTC, Jim wrote: What is the problem here? Should I not call `destroy`? If so, what should I call instead? The problem is that you've marked main as `@nogc`, and `destroy` is not `@nogc`. Remove

Re: Destructors can't be @nogc?

2021-07-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 23 July 2021 at 20:24:02 UTC, Jim wrote: What is the problem here? Should I not call `destroy`? If so, what should I call instead? The problem is that you've marked main as `@nogc`, and `destroy` is not `@nogc`. Remove the annotation from main and it will compile.

Re: how to test (at compilation-time) for existence of an already-declared object ?

2021-07-23 Thread someone via Digitalmars-d-learn
On Saturday, 24 July 2021 at 01:44:11 UTC, Adam D Ruppe wrote: On Saturday, 24 July 2021 at 01:29:26 UTC, someone wrote: Suppose I have a module with the following: static if(is(classTickerCustomNYSE)) // it was a valid type else // it was not a valid type can use that to test. you can

Re: how to test (at compilation-time) for existence of an already-declared object ?

2021-07-23 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 24 July 2021 at 01:29:26 UTC, someone wrote: Suppose I have a module with the following: static if(is(classTickerCustomNYSE)) // it was a valid type else // it was not a valid type can use that to test. you can also mix in the name static if(is(mixin("class name here")))

how to test (at compilation-time) for existence of an already-declared object ?

2021-07-23 Thread someone via Digitalmars-d-learn
Suppose I have a module with the following: ```d public class classTickerCustomNYSE : classTickerCommon { ... } public class classTickerCustomNASDAQ : classTickerCommon { ... } ``` ... and given that I also have the following in the same module: ```d public enum structureExchanges = [ r"NYSE

Re: Build time

2021-07-23 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 23 July 2021 at 19:09:02 UTC, JG wrote: I am not sure how relevant it is but it is a compiler that I have been writing, not something serious (yet - if ever). Compile time optimizations are a bit weird compared to runtime ones - things that would fast at run time may actually be ver

Re: POST request with std.net.curl

2021-07-23 Thread bachmeier via Digitalmars-d-learn
On Friday, 23 July 2021 at 19:59:33 UTC, Ali Çehreli wrote: On 7/23/21 11:11 AM, bachmeier wrote: I'm writing a D program that interacts with the Todoist API using std.net.curl. It's not a problem to do get requests to query tasks, but I cannot find a way to get post to work to create a new ta

testFilename in std.stdio

2021-07-23 Thread Rogni via Digitalmars-d-learn
Hi everyone. I have a file main.d ``` import std.stdio: writeln; int main (string []) { return 0; } ``` When I try to get depend files with command `ldc2 main.d --unittest --deps=main.deps --o-` such errors are received: ``` /home/mak/progs/ldc2-1.26.0-linux-x86_64/bin/../import/std/stdio.d(5

Destructors can't be @nogc?

2021-07-23 Thread Jim via Digitalmars-d-learn
Hello, I've been playing with D and trying to understand how to work with @nogc. I must be doing something wrong, because even though I tagged the destructor for my class `@nogc`, I'm getting the following error: `.\min.d(27): Error: "@nogc" function "D main" cannot call non-@nogc function "o

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/23/21 3:30 PM, apz28 wrote: On Friday, 23 July 2021 at 18:44:47 UTC, Steven Schveighoffer wrote: On 7/22/21 7:43 PM, apz28 wrote: In any case, it's possible that fbConnection being null does not mean a null dereference, but I'd have to see the class itself. I'm surprised if you don't g

Re: Build time

2021-07-23 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 23 July 2021 at 19:32:08 UTC, H. S. Teoh wrote: And avoid doing too much work in CTFE, which is known to be slow. Well it very much depends HOW you do it. Like the ~= operation in ctfe is awfully slow and wastes a lot of memory depending on the size of the string, but if you preall

Re: Build time

2021-07-23 Thread Dennis via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: Any suggestion on how to try and improve the build time. I am currently using dub. You can try profiling it with LDC 1.25 or later. Add this to dub.sdl: ``` dflags "--ftime-trace" platform="ldc" dflags "--ftime-trace-file=./my-trace.json" pl

Re: POST request with std.net.curl

2021-07-23 Thread Ali Çehreli via Digitalmars-d-learn
On 7/23/21 11:11 AM, bachmeier wrote: I'm writing a D program that interacts with the Todoist API using std.net.curl. It's not a problem to do get requests to query tasks, but I cannot find a way to get post to work to create a new task. This is a working bash script, where APIKEY is defined e

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-23 Thread Ali Çehreli via Digitalmars-d-learn
On 7/23/21 12:30 PM, apz28 wrote: > The -debug build with passing unit-tests so no problem there. > The -release build is having problem. After make change to accommodate > it, it takes forever to build. I started it yesterday 11AM and it is > still compiling now (more than a day already.) It tak

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-23 Thread apz28 via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:44:47 UTC, Steven Schveighoffer wrote: On 7/22/21 7:43 PM, apz28 wrote: In any case, it's possible that fbConnection being null does not mean a null dereference, but I'd have to see the class itself. I'm surprised if you don't get a null dereference in non-rele

Re: Build time

2021-07-23 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jul 23, 2021 at 06:53:06PM +, JG via Digitalmars-d-learn wrote: [...] > The program I writing is around 3000 loc and recently I noticed a > large slow down in compile time which after investigation seemed to be > caused by my computer running out of memory. The compile was using > more

Re: Build time

2021-07-23 Thread JG via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:57:46 UTC, Adam D Ruppe wrote: On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: The program I writing is around 3000 loc what's the code? I am not sure how relevant it is but it is a compiler that I have been writing, not something serious (yet - if ever).

Re: Build time

2021-07-23 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: The program I writing is around 3000 loc what's the code?

Build time

2021-07-23 Thread JG via Digitalmars-d-learn
Hi, The program I writing is around 3000 loc and recently I noticed a large slow down in compile time which after investigation seemed to be caused by my computer running out of memory. The compile was using more than 15GB memory. I tried using lowmem and that did solve the memory problem but

Re: enum true, or 1

2021-07-23 Thread Ali Çehreli via Digitalmars-d-learn
On 7/22/21 1:44 PM, Brian Tiffin wrote: > So would there be any cringes Not from me. :) > seeing a skeleton D source file that > always ended with > > ~~~d > /++ > Disclaimer > > This software is distributed in the hope that it will be useful, but > WITHOUT ANY WARRANTY; direct or

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/21 7:43 PM, apz28 wrote: FbConnection is a class, FbXdrReader is a struct and for this call, response.data is not null & its' length will be greater than zero and FbConnection is not being used. So why DMD try to evaluate at compiled time hence error 1. Should not evaluate at compile

POST request with std.net.curl

2021-07-23 Thread bachmeier via Digitalmars-d-learn
I'm writing a D program that interacts with the Todoist API using std.net.curl. It's not a problem to do get requests to query tasks, but I cannot find a way to get post to work to create a new task. This is a working bash script, where APIKEY is defined elsewhere and $1 and $2 are user input

Re: Cannot always deduce template arguments when using implicitly cast array literals

2021-07-23 Thread Rekel via Digitalmars-d-learn
On Friday, 23 July 2021 at 14:41:41 UTC, Paul Backus wrote: The first is to change the type of right from const R to const T[L1], which removes the type specialization: Thanks for suggesting that fix, removing R altogether is a very simple solution I hadn't considered. :) Unfortunately, the

Re: Cannot always deduce template arguments when using implicitly cast array literals

2021-07-23 Thread Paul Backus via Digitalmars-d-learn
On Friday, 23 July 2021 at 13:53:27 UTC, Rekel wrote: After simplifying a part of my code I found the following code cannot deduce the template arguments, but I have no clue why. ```d void foo(L : T[L1][L2], uint L1, uint L2, T, R: T[L1])(const L left, const R right) { /

Cannot always deduce template arguments when using implicitly cast array literals

2021-07-23 Thread Rekel via Digitalmars-d-learn
After simplifying a part of my code I found the following code cannot deduce the template arguments, but I have no clue why. ```d void foo(L : T[L1][L2], uint L1, uint L2, T, R: T[L1])(const L left, const R right) { // Function } void bar(uint L)(float[L] l) { //

Re: associative array with Parallel

2021-07-23 Thread seany via Digitalmars-d-learn
On Thursday, 22 July 2021 at 16:39:45 UTC, Steven Schveighoffer wrote: On 7/22/21 1:46 AM, seany wrote: [...] Correct. You must synchronize on ii. [...] This isn't valid code, because you can't append to an integer. Though I think I know what you meant. Is it thread-safe (assuming the ar

Re: Generate docs for generated code?

2021-07-23 Thread wjoe via Digitalmars-d-learn
On Friday, 23 July 2021 at 10:54:33 UTC, Adam D Ruppe wrote: On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote: Is there a way for the compiler to consider doc comments in auto generated, mixed in code? If you use my adrdox generator (which runs on the dpldocs.info website), it handles mixi

Re: Generate docs for generated code?

2021-07-23 Thread wjoe via Digitalmars-d-learn
On Friday, 23 July 2021 at 10:42:22 UTC, user1234 wrote: On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote: Is there a way for the compiler to consider doc comments in auto generated, mixed in code? E.g. ```D string fooImpl = q{ /// Bar does fancy things. const void bar() { /*do somethi

Re: Generate docs for generated code?

2021-07-23 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote: Is there a way for the compiler to consider doc comments in auto generated, mixed in code? If you use my adrdox generator (which runs on the dpldocs.info website), it handles mixin templates. See http://dpldocs.info/experimental-docs/std.n

Re: Generate docs for generated code?

2021-07-23 Thread user1234 via Digitalmars-d-learn
On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote: Is there a way for the compiler to consider doc comments in auto generated, mixed in code? E.g. ```D string fooImpl = q{ /// Bar does fancy things. const void bar() { /*do something fancy*/ } }; /// This is Foo struct Foo(A, B, C) { m

Generate docs for generated code?

2021-07-23 Thread wjoe via Digitalmars-d-learn
Is there a way for the compiler to consider doc comments in auto generated, mixed in code? E.g. ```D string fooImpl = q{ /// Bar does fancy things. const void bar() { /*do something fancy*/ } }; /// This is Foo struct Foo(A, B, C) { mixin(fooImpl); } ``` So that the documentation for ``