Re: how can I load html files and not .dt or diet files in vibe.d

2024-02-01 Thread Aravinda VK via Digitalmars-d-learn
On Thursday, 1 February 2024 at 03:20:31 UTC, dunkelheit wrote: !!! 5 html body h1 hello diet -iframe("hola.html") please help me :') Try ``` html body h1 hello diet iframe(src="hola.html") ```

Re: how can I load html files and not .dt or diet files in vibe.d

2024-02-01 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 1 February 2024 at 03:20:31 UTC, dunkelheit wrote: this is my code, I'm a begginer on vibe, and I want to use html and not diet files Take a look at the static file example, I think that's close to what you're looking for. https://github.com/vibe-d/vibe.d/blob/master/examples/ht

Re: Setting field of struct object

2024-02-01 Thread TheTeaLady via Digitalmars-d-learn
On Monday, 22 January 2024 at 15:47:23 UTC, bachmeier wrote: On Monday, 22 January 2024 at 15:45:45 UTC, zjh wrote: On Monday, 22 January 2024 at 15:33:01 UTC, ryuukk_ wrote: it only took me 1 project to never want to touch C++ again.. D language used to have no `copy constructor`, isn't it

Re: Setting field of struct object

2024-02-01 Thread Anonymouse via Digitalmars-d-learn
On Monday, 22 January 2024 at 08:27:36 UTC, Joel wrote: ```d import std; struct Person { string name, email; ulong age; auto withName(string name) { this.name=name; return this; } auto withEmail(string email) { this.email=email; return this; } auto withAge(ulong age) { this

import locality with function parameters

2024-02-01 Thread Carl Sturtivant via Digitalmars-d-learn
Hello, I seem to recall that there is surprising template to import a module and get a type from it inside the declaration of the type of a parameter to a function, so that the module need not be imported outside of the function definition. I think there was a blog article some years ago abou

Re: import locality with function parameters

2024-02-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 2 February 2024 at 00:29:51 UTC, Carl Sturtivant wrote: Hello, I seem to recall that there is surprising template to import a module and get a type from it inside the declaration of the type of a parameter to a function, so that the module need not be imported outside of the functi

Re: Setting field of struct object

2024-02-01 Thread TheTeaLady via Digitalmars-d-learn
On Monday, 22 January 2024 at 11:31:11 UTC, zjh wrote: On Monday, 22 January 2024 at 08:54:54 UTC, zjh wrote: ```d struct Person { string name, email; ulong age; } Person a{"n","email",33}; ``` C++ can achieve ultimate `simplicity` without violating `DRY`, And here, D violates the `D

Re: how can I load html files and not .dt or diet files in vibe.d

2024-02-01 Thread Menjanahary R. R. via Digitalmars-d-learn
On Thursday, 1 February 2024 at 03:20:31 UTC, dunkelheit wrote: this is my code, I'm a begginer on vibe, and I want to use html and not diet files `import vibe.vibe; void main() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = [":

Re: import locality with function parameters

2024-02-01 Thread Carl Sturtivant via Digitalmars-d-learn
On Friday, 2 February 2024 at 01:23:11 UTC, Steven Schveighoffer wrote: Are you thinking of this? https://dlang.org/phobos/object.html#.imported -Steve Yes! Glad it's now part of D. Thank you.

template/mixin magic for to! auto inferring type from variable

2024-02-01 Thread Chris Katko via Digitalmars-d-learn
Is there some way to do: ```D string[3] data; //strings from some file input, some are ints, uints, etc. auto into!(T)(T value){return to!???(value); } // ??? uint time = into!(data[1]); // We already know this is uint int priority = into!(data[2]); ``` instead of: ```D uint time = to!uint(da