Recommendation about templating engine library

2024-03-11 Thread Andrea via Digitalmars-d-learn
Hi folks, Working on a side project I have the need to generate text files (mainly D source code) via a templating system. My use case is to have some JSON data populated at runtime from an API and fill-in placeholders in the text with the ability of doing loops over arrays, simple conditions

Re: Recommendation about templating engine library

2024-03-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 11 March 2024 at 14:26:01 UTC, Andrea wrote: Hi folks, Working on a side project I have the need to generate text files (mainly D source code) via a templating system. My use case is to have some JSON data populated at runtime from an API and fill-in placeholders in the text with t

Re: Recommendation about templating engine library

2024-03-11 Thread Sergey via Digitalmars-d-learn
On Monday, 11 March 2024 at 14:26:01 UTC, Andrea wrote: Opinions ? Many thanks There is also diet : https://code.dlang.org/packages/diet-ng

Re: Recommendation about templating engine library

2024-03-11 Thread Andrea via Digitalmars-d-learn
On Monday, 11 March 2024 at 15:22:39 UTC, Sergey wrote: On Monday, 11 March 2024 at 14:26:01 UTC, Andrea wrote: Opinions ? Many thanks There is also diet : https://code.dlang.org/packages/diet-ng Is'nt `diet` specific for HTML / XML structured text ?

Re: Recommendation about templating engine library

2024-03-11 Thread bachmeier via Digitalmars-d-learn
On Monday, 11 March 2024 at 14:59:52 UTC, Ferhat Kurtulmuş wrote: You have already mentioned mustache-d. If it compiles with the recent compilers go for it. I used it some time a go for a similar task involving in d code gen. I found mustache-d easy enough and good enough for my needs. I hav

static functions?

2024-03-11 Thread Andy Valencia via Digitalmars-d-learn
Leveraging my knowledge of C, I assumed a "static" function would be hidden outside of its own source file. I can't find any statement about the semantics of a static function in the documentation, and in practice (ldc2 on Linux) it doesn't hide the function? file tst.d: import std.stdio :

Re: Recommendation about templating engine library

2024-03-11 Thread Sergey via Digitalmars-d-learn
On Monday, 11 March 2024 at 15:34:11 UTC, Andrea wrote: There is also diet : https://code.dlang.org/packages/diet-ng Is'nt `diet` specific for HTML / XML structured text ? right. Just mentioned Go library also mostly for HTML generation.

Re: Recommendation about templating engine library

2024-03-11 Thread Andrea via Digitalmars-d-learn
On Monday, 11 March 2024 at 15:50:28 UTC, bachmeier wrote: I found mustache-d easy enough and good enough for my needs. I haven't used it with a recent compiler, but it's hard to see how it would need much maintenance. just trying it out and kinda fits my needs; the main issues are lack of

Re: static functions?

2024-03-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 11, 2024 9:56:24 AM MDT Andy Valencia via Digitalmars-d-learn wrote: > Leveraging my knowledge of C, I assumed a "static" function would > be hidden outside of its own source file. I can't find any > statement about the semantics of a static function in the > documentation, and i

Re: static functions?

2024-03-11 Thread Andy Valencia via Digitalmars-d-learn
On Monday, 11 March 2024 at 16:25:13 UTC, Jonathan M Davis wrote: ... But what exactly static means varies based on the context. Thank you for the list! But none of those appear to apply to a function defined in the outermost scope of the module. Is static accepted here--but has no actual e

Re: static functions?

2024-03-11 Thread user1234 via Digitalmars-d-learn
On Monday, 11 March 2024 at 16:51:48 UTC, Andy Valencia wrote: On Monday, 11 March 2024 at 16:25:13 UTC, Jonathan M Davis wrote: ... But what exactly static means varies based on the context. Thank you for the list! But none of those appear to apply to a function defined in the outermost sco

Re: static functions?

2024-03-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 11, 2024 10:51:48 AM MDT Andy Valencia via Digitalmars-d- learn wrote: > On Monday, 11 March 2024 at 16:25:13 UTC, Jonathan M Davis wrote: > > ... > > But what exactly static means varies based on the context. > > Thank you for the list! But none of those appear to apply to a > fu

How to use eventcore write an echo server?

2024-03-11 Thread zoujiaqing via Digitalmars-d-learn
I use eventcore latest version write an echo server for test. some error of build. my D code: ```D import eventcore.core; import std.functional : toDelegate; import std.socket : InternetAddress; import std.exception : enforce; import core.time : Duration; import std.stdio : writeln; void main

Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-11 Thread Liam McGillivray via Digitalmars-d-learn
I am in need of a data type for holding direction information; one of 8 directions on a single axis. They are named in terms of compass directions. If D had a 4-bit datatype, I would just use this and do `+=2` whenever I want to change the datatype, but it doesn't. Perhaps this would be a goo

Disable wrilten buf in docker

2024-03-11 Thread zoujiaqing via Digitalmars-d-learn
Hi, my application use writeln in docker don't display. Python add -u disable it. https://stackoverflow.com/questions/29663459/why-doesnt-python-app-print-anything-when-run-in-a-detached-docker-container

Re: Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
By taking advantage of integer wrapping and a bitwise and, its quite a simple problem to solve! Challenge for the reader: add support for binary operations and toString support. https://dlang.org/spec/operatoroverloading.html ```d struct Direction { private int value; Direction opUn

Re: Disable wrilten buf in docker

2024-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On D's side you can use ``stdout.flush;`` to force it to flush. I don't think there is a way to force flushing via CLI.