Re: alias restriction??!

2020-07-18 Thread Basile B. via Digitalmars-d-learn
On Saturday, 18 July 2020 at 22:49:18 UTC, Dennis wrote: On Saturday, 18 July 2020 at 18:46:16 UTC, Carl Sturtivant wrote: Is there any way to avoid the duplication of the entries in the anonymous union, aside from using a mixin template? I think this would be fixed if

Re: alias restriction??!

2020-07-18 Thread Dennis via Digitalmars-d-learn
On Saturday, 18 July 2020 at 18:46:16 UTC, Carl Sturtivant wrote: Is there any way to avoid the duplication of the entries in the anonymous union, aside from using a mixin template? I think this would be fixed if https://github.com/dlang/dmd/pull/11273 gets merged.

Re: Good way to send/receive UDP packets?

2020-07-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 July 2020 at 16:00:09 UTC, Dukc wrote: I have a project where I need to take and send UDP packets over the Internet. Only raw UDP I wrote an example using phobos on my blog a while ago that might help you get started:

Redundant function calls in filtered joined range

2020-07-18 Thread FreeSlave via Digitalmars-d-learn
Consider the following code. It counts the number of subdirectories in directories provided via commandline args. import std.stdio; import std.algorithm; import std.file; import std.range; import std.exception; @trusted bool isDirNothrow(string dir) nothrow { bool ok;

Re: vibe.d and my first web service

2020-07-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: by ctrl + c and start again the program cannot start again with error message: Failed to listen on ::1:8080 Failed to listen on 127.0.0.1:8080 Failed to listen for incoming HTTP connections on any of the supplied interfaces.

Re: Good way to send/receive UDP packets?

2020-07-18 Thread IGotD- via Digitalmars-d-learn
On Saturday, 18 July 2020 at 16:00:09 UTC, Dukc wrote: I have a project where I need to take and send UDP packets over the Internet. Only raw UDP - my application uses packets directly, with their starting `[0x5a, packet.length.to!ubyte]` included. And only communication with a single address,

alias restriction??!

2020-07-18 Thread Carl Sturtivant via Digitalmars-d-learn
Here's a toy version of a problem in the wild. struct S { long first; union T { long one; double two; } T second; alias First = first; alias Second = second.one; } void main() { S x; x.First = 4; x.Second = 5; // compilation error: "Error:

Re: Good way to send/receive UDP packets?

2020-07-18 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jul 18, 2020 at 04:00:09PM +, Dukc via Digitalmars-d-learn wrote: > I have a project where I need to take and send UDP packets over the > Internet. Only raw UDP - my application uses packets directly, with > their starting `[0x5a, packet.length.to!ubyte]` included. And only >

Re: vibe.d and my first web service

2020-07-18 Thread Mr. Backup via Digitalmars-d-learn
On Saturday, 18 July 2020 at 12:16:09 UTC, Andre Pany wrote: On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: [...] I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your problem: ​"versions": [ "VibeHighEventPriority" ] (Restart

Re: My RPN calculator code review?

2020-07-18 Thread Dukc via Digitalmars-d-learn
On Friday, 17 July 2020 at 21:37:46 UTC, AB wrote: I'd appreciate your opinions regarding style, mistakes/code smell/bad practice. Thank you. In a project this small, implementability (meaning, ease of writing) is really the main guideline, readability is a non-issue. When your codebase hits

Good way to send/receive UDP packets?

2020-07-18 Thread Dukc via Digitalmars-d-learn
I have a project where I need to take and send UDP packets over the Internet. Only raw UDP - my application uses packets directly, with their starting `[0x5a, packet.length.to!ubyte]` included. And only communication with a single address, no need to communicate with multiple clients

Re: vibe.d and my first web service

2020-07-18 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: Hello, I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example: import vibe.vibe; void main() { auto settings

Re: My RPN calculator code review?

2020-07-18 Thread AB via Digitalmars-d-learn
On Saturday, 18 July 2020 at 10:33:23 UTC, Anonymouse wrote: I'm not happy about the looping and allocating replacements of spaced_args, Actually, I got rid of that code entirely in order to support negative values: -5 -6 * == 30

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: vibe.d and my first web service

2020-07-18 Thread aliak via Digitalmars-d-learn
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: Hello, I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example: [...] Think it's just Vibe.d: I had a similar issue:

Re: Why is typeof(readln) -> void?

2020-07-18 Thread rikki cattermole via Digitalmars-d-learn
On 18/07/2020 9:14 PM, blizzard wrote: Can anybody explain the difference between readln() and readln? I read somewhere that the () were optional, so why this difference? The brackets are optional when calling a function. You are not calling a function if you wrap it in typeof. "The

vibe.d and my first web service

2020-07-18 Thread Mr. Backup via Digitalmars-d-learn
Hello, I wanted to create simple web service to start learning more about D lang and compare with another languages. I have used "dub init -t vibe.d" to create basic example: import vibe.vibe; void main() { auto settings = new HTTPServerSettings; settings.port = 8080;

Why is typeof(readln) -> void?

2020-07-18 Thread blizzard via Digitalmars-d-learn
``` import std.stdio; void main() { writeln(typeof(readln()).stringof); // string writeln(typeof(readln).stringof); // void } ``` Can anybody explain the difference between readln() and readln? I read somewhere that the () were optional, so why this difference?

Re: How can I get Phobos Runtime Library docummentation in PDF?

2020-07-18 Thread aberba via Digitalmars-d-learn
On Saturday, 18 July 2020 at 00:23:22 UTC, Marcone wrote: I need full Phobos Runtime Library docummentation in only one PDF file. I'm not sure how to generate docs in a single html page but there's external services or tools to terms HTML files into PDF and much it all into one. This can be

Re: How to generate ddoc html?

2020-07-18 Thread aberba via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 20:50:14 UTC, Pavel Shkadzko wrote: I've been skimming through https://dlang.org/spec/ddoc.html in order to understand how can one use ddoc to generate nice htmls. [...] This post contains information on how to do that.

Re: How to generate ddoc html?

2020-07-18 Thread aberba via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 20:50:14 UTC, Pavel Shkadzko wrote: I've been skimming through https://dlang.org/spec/ddoc.html in order to understand how can one use ddoc to generate nice htmls. I tend to use markdown to log some daily work or copy down code examples. For learning purposes I