Re: How to create a API server?

2022-12-18 Thread TTK Ciar via Digitalmars-d-learn
On Friday, 16 December 2022 at 22:10:37 UTC, TTK Ciar wrote: On Friday, 16 December 2022 at 20:57:30 UTC, Dariu Drew wrote: Hi! i need help in can i create a serve API, what library i should use? what documentation i should read? The arsd package includes arsd.http2 which makes it easy to imp

Re: How to create a API server?

2022-12-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 18 December 2022 at 09:34:06 UTC, TTK Ciar wrote: Oops, wrong module!! I meant arsd.cgi, very sorry! Yes, http2.d is the client side for http, arsd.cgi implements the http server.

Re: printf, writeln, writefln

2022-12-18 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 10 December 2022 at 11:13:57 UTC, Nick Treleaven wrote: It was bizarre and confusing that assignment syntax was implemented for functions and methods not explicitly marked with @property. Hi Nick, do you think this is confusing? ```d void main() { struct S { int value;

No need opUnary

2022-12-18 Thread Salih Dincer via Digitalmars-d-learn
Don't you think it's interesting that it doesn't need unary operator overloading? ```d import std.stdio; struct S { int value; alias opCall this; this(int i) { value = i; } alias opAssign = opCall; @property opCall(int x) { return value = x; } @property opCall() inout

Re: How to create a API server?

2022-12-18 Thread Sergey via Digitalmars-d-learn
On Friday, 16 December 2022 at 20:57:30 UTC, Dariu Drew wrote: Hi! i need help in can i create a serve API, what library i should use? what documentation i should read? Check the bench: https://github.com/tchaloupka/httpbench there are a lot of web servers in D. You can find one that fits your

Re: printf, writeln, writefln

2022-12-18 Thread j via Digitalmars-d-learn
On Sunday, 18 December 2022 at 16:17:40 UTC, Salih Dincer wrote: On Saturday, 10 December 2022 at 11:13:57 UTC, Nick Treleaven wrote: It was bizarre and confusing that assignment syntax was implemented for functions and methods not explicitly marked with @property. Hi Nick, do you think this

Re: How to create a API server?

2022-12-18 Thread j via Digitalmars-d-learn
On Sunday, 18 December 2022 at 17:05:45 UTC, Sergey wrote: On Friday, 16 December 2022 at 20:57:30 UTC, Dariu Drew wrote: Hi! i need help in can i create a serve API, what library i should use? what documentation i should read? Check the bench: https://github.com/tchaloupka/httpbench there are

Re: No need opUnary

2022-12-18 Thread j via Digitalmars-d-learn
On Sunday, 18 December 2022 at 16:21:05 UTC, Salih Dincer wrote: Don't you think it's interesting that it doesn't need unary operator overloading? ```d import std.stdio; struct S { int value; alias opCall this; this(int i) { value = i; } alias opAssign = opCall; @property opC

Re: pointer escaping return scope bug?

2022-12-18 Thread j via Digitalmars-d-learn
On Saturday, 19 November 2022 at 14:07:59 UTC, Nick Treleaven wrote: Hi, The following seems like a bug to me (reduced code, FILE* changed to int*): ```d @safe: struct LockedFile { private int* fps; auto fp() return scope => fps; } void main() { int* p; { auto lf = Lo

Re: Preventing nested struct destructor accessing stack frame

2022-12-18 Thread j via Digitalmars-d-learn
On Friday, 16 December 2022 at 12:17:40 UTC, Nick Treleaven wrote: This code segfaults when the GC calls the dtor after the unittest succeeds: ```d unittest { int i; struct S { ~this() { i++; } } (*new S).destroy; } ``` It seems destroy clears the context pointer. I

Re: How to use version in dub?

2022-12-18 Thread j via Digitalmars-d-learn
On Tuesday, 13 December 2022 at 19:28:44 UTC, Leonardo A wrote: Hello. How to use version in dub? https://dlang.org/spec/version.html "The version level and version identifier can be set on the command line by the -version" I tried everything but noting. Look for a file called dub.json.

Re: GDC binary for windows?

2022-12-18 Thread j via Digitalmars-d-learn
On Thursday, 15 December 2022 at 21:43:07 UTC, TheZipCreator wrote: is there a compiled binary of GDC anywhere? I looked at https://www.gdcproject.org/downloads, and the link there goes to winlibs, but after downloading the archive I couldn't find gdc anywhere in it. I did some research and [it

Re: Is there such concept of a list in D?

2022-12-18 Thread j via Digitalmars-d-learn
On Saturday, 10 December 2022 at 05:46:26 UTC, thebluepandabear wrote: In most languages there is some sort of `List` type, is that the same for D? What you're probably talking about is called a union in the C world. There is a nice (free) book by Ali that every Dlang beginner should probab

Re: gcc -E -dD; dstep; sqlite3

2022-12-18 Thread j via Digitalmars-d-learn
On Thursday, 8 December 2022 at 16:55:34 UTC, johannes wrote: /we-/we/sqlite3/package.d(121): Error: semicolon expected following auto declaration, not `32` /we-/we/sqlite3/package.d(121): Error: declaration expected, not `32` /we-/we/sqlite3/package.d(122): Error: semicolon expected following

Re: Is there such concept of a list in D?

2022-12-18 Thread thebluepandabear via Digitalmars-d-learn
On Sunday, 18 December 2022 at 22:17:04 UTC, j wrote: On Saturday, 10 December 2022 at 05:46:26 UTC, thebluepandabear wrote: In most languages there is some sort of `List` type, is that the same for D? What you're probably talking about is called a union in the C world. There is a nice (fre

Re: No need opUnary

2022-12-18 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote: Why are you using `@property` everywhere? You are right but if I don't use it for `opCall()` the output will be like `S(9)`. Likewise, if I don't use `inout`, the program is terminated. I think it's a bug with `std.format` that I said l

Re: Is there such concept of a list in D?

2022-12-18 Thread j via Digitalmars-d-learn
On Monday, 19 December 2022 at 03:31:05 UTC, thebluepandabear wrote: On Sunday, 18 December 2022 at 22:17:04 UTC, j wrote: On Saturday, 10 December 2022 at 05:46:26 UTC, thebluepandabear wrote: In most languages there is some sort of `List` type, is that the same for D? What you're probably

Re: No need opUnary

2022-12-18 Thread j via Digitalmars-d-learn
On Monday, 19 December 2022 at 04:26:39 UTC, Salih Dincer wrote: On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote: Why are you using `@property` everywhere? You are right but if I don't use it for `opCall()` the output will be like `S(9)`. Likewise, if I don't use `inout`, the program i

Re: No need opUnary

2022-12-18 Thread j via Digitalmars-d-learn
On Monday, 19 December 2022 at 04:26:39 UTC, Salih Dincer wrote: On Sunday, 18 December 2022 at 21:17:02 UTC, j wrote: Why are you using `@property` everywhere? You are right but if I don't use it for `opCall()` the output will be like `S(9)`. Likewise, if I don't use `inout`, the program i