Re: how stdin stream works?

2020-08-23 Thread Flade via Digitalmars-d-learn
On Thursday, 20 August 2020 at 19:13:31 UTC, Ali Çehreli wrote: On 8/19/20 11:46 AM, Flade wrote: [...] In some cases clearerr() and readln() may be what is needed: import std.stdio; void main() { int x; bool accepted = false; while (!accepted) { try { write("x: ");

Re: how stdin stream works?

2020-08-23 Thread Flade via Digitalmars-d-learn
On Thursday, 20 August 2020 at 19:13:31 UTC, Ali Çehreli wrote: On 8/19/20 11:46 AM, Flade wrote: [...] Thanks Steve! I will get the input a string then as you said and then I'll try to convert it! Thanks a lot, have a nice day! In some cases clearerr() and readln() may be what is needed:

Re: vibe.d and my first web service

2020-08-23 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 23 August 2020 at 06:41:03 UTC, Pierce Ng wrote: On Thursday, 20 August 2020 at 18:13:46 UTC, ddcovery wrote: [...] Recently I too started to look at web frameworks for compiled languages. Currently playing with Free Pascal - fast compiler, several web frameworks to evaluate, and

Re: vibe.d and my first web service

2020-08-23 Thread Pierce Ng via Digitalmars-d-learn
On Sunday, 23 August 2020 at 09:56:25 UTC, Andre Pany wrote: Please have a look at the end of this site: https://d-land.sepany.de/tutorials/cloud/sichere-docker-images-fuer-cloud-anwendungen-erstellen/ It describes how to build really small vibed applications on Alpine by using docker scratch im

Re: __FILE__ and __LINE__ in case of import expression

2020-08-23 Thread Andrey Zherikov via Digitalmars-d-learn
On Saturday, 22 August 2020 at 03:43:10 UTC, Steven Schveighoffer wrote: On 8/21/20 6:34 PM, Adam D. Ruppe wrote: On Friday, 21 August 2020 at 22:12:48 UTC, Steven Schveighoffer wrote: And honestly, if it says the source is "mixin-50, line 1", I think people will get it. I could probably live

Re: __FILE__ and __LINE__ in case of import expression

2020-08-23 Thread Andrey Zherikov via Digitalmars-d-learn
On Friday, 21 August 2020 at 22:34:49 UTC, Adam D. Ruppe wrote: On Friday, 21 August 2020 at 22:12:48 UTC, Steven Schveighoffer wrote: Who does that though? An incompetent coder: http://dpldocs.info/experimental-docs/source/arsd.cgi.d.html#L5713 http://dpldocs.info/experimental-docs/source/ar

Re: __FILE__ and __LINE__ in case of import expression

2020-08-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 23 August 2020 at 12:50:36 UTC, Andrey Zherikov wrote: Even this approach can lead to unclear result if you move 'q{...}' outside of mixin: Yes, that's why I write it very specifically the way I do, with q{ and mixin on the same line.

Re: __FILE__ and __LINE__ in case of import expression

2020-08-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/23/20 8:42 AM, Andrey Zherikov wrote: On Saturday, 22 August 2020 at 03:43:10 UTC, Steven Schveighoffer wrote: On 8/21/20 6:34 PM, Adam D. Ruppe wrote: On Friday, 21 August 2020 at 22:12:48 UTC, Steven Schveighoffer wrote: And honestly, if it says the source is "mixin-50, line 1", I think

String mixin from within a template

2020-08-23 Thread data pulverizer via Digitalmars-d-learn
Hi all, I am trying to dynamically create compile time variables by using string and template mixins. I have tried both approaches and they have failed. The central thing I am trying to create is a line like this: ```d `alias x` ~ i ~ ` = Remove(indexes[i] - i, Args);` ``` where a compile t

Re: String mixin from within a template

2020-08-23 Thread ag0aep6g via Digitalmars-d-learn
On Sunday, 23 August 2020 at 19:42:47 UTC, data pulverizer wrote: `alias x` ~ i ~ ` = Remove(indexes[i] - i, x`~ (i - 1) ~ `);` [...] ```d Error: no identifier for declarator x ``` Indicating that the concatenation `~` is not working, and I only get the partial string when I print out `pragma

Re: String mixin from within a template

2020-08-23 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 23 August 2020 at 20:12:12 UTC, ag0aep6g wrote: On Sunday, 23 August 2020 at 19:42:47 UTC, data pulverizer wrote: `alias x` ~ i ~ ` = Remove(indexes[i] - i, x`~ (i - 1) ~ `);` [...] ```d Error: no identifier for declarator x ``` Indicating that the concatenation `~` is not working,

Re: String mixin from within a template

2020-08-23 Thread ag0aep6g via Digitalmars-d-learn
On Sunday, 23 August 2020 at 20:54:22 UTC, data pulverizer wrote: compiled string 1: alias x0 = Remove(indicies[i] - i, Args); Error: found - when expecting ) Error: semicolon expected to close alias declaration Error: no identifier for declarator i Error: declaration expected, not , ... repeated

Re: String mixin from within a template

2020-08-23 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 23 August 2020 at 21:13:51 UTC, ag0aep6g wrote: On Sunday, 23 August 2020 at 20:54:22 UTC, data pulverizer wrote: compiled string 1: alias x0 = Remove(indicies[i] - i, Args); Error: found - when expecting ) Error: semicolon expected to close alias declaration Error: no identifier for