What is the correct way of making this output `0 1 2`?
```d
void delegate()[] dgs;
foreach (immutable i; 0..3)
{
dgs ~= () => writeln(i);
}
foreach (dg; dgs)
{
dg(); // outputs: `2 2 2`
}
```
I need to use gcloud NLP api which has the url and endpoint like
this
"https://language.googleapis.com/v1beta2/documents:analyzeSentiment";. The ":" between documents and analyzeSentiment make a lot trouble for me. Just don't know how to setup the @path in RestInterface for such endpoint. I tried
On Tuesday, 14 June 2022 at 08:26:53 UTC, Anonymouse wrote:
What is the correct way of making this output `0 1 2`?
```d
void delegate()[] dgs;
foreach (immutable i; 0..3)
{
dgs ~= () => writeln(i);
}
foreach (dg; dgs)
{
dg(); // outputs: `2 2 2`
}
```
You have to do it like this:
`
I have [pretty simple code in my
library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47):
```d
alias CC = SumType!(AA,BB);
struct AA {}
struct BB
{
CC[] c;
}
private void ppp(T, Output)(auto ref Output output, in
CommandArguments!T cmd, in Config config
Hello
Tried to give ImportC a try to finally get rid of gluecode in one
of my project, but this simple test gives me a compile error:
nk.c
```
int test(void)
{
return 1;
}
```
app.d
```
import std.stdio;
import nk = nk;
void main()
{
if (nk.test() != 0)
{
writeln("te
On Tuesday, 14 June 2022 at 14:32:50 UTC, ryuukk_ wrote:
```
nk.obj : error LNK2019: unresolved external symbol test
referenced in function _Dmain
```
Am i missing something important? (that is a dub project,
created with: dub init)
DMD: v2.100.0-dirty
This works from the command line:
On Tuesday, 14 June 2022 at 14:38:17 UTC, Mike Parker wrote:
On Tuesday, 14 June 2022 at 14:32:50 UTC, ryuukk_ wrote:
```
nk.obj : error LNK2019: unresolved external symbol test
referenced in function _Dmain
```
Am i missing something important? (that is a dub project,
created with: dub in
On 6/14/22 02:04, bauss wrote:
> You have to do it like this:
>
> ```
> dgs ~= ( (n) => () { writeln(n); })(i);
> ```
The same thing with a named function as well as with iota():
import std.range;
import std.algorithm;
import std.stdio;
void main() {
void delegate()[] dgs;
auto makeDg(int
Hi,
Is this a bug?
```d
import std;
template test(alias f) {
auto test(I)(I i) { return f(i); }
}
void main()
{
alias t = test!(x=>x+1);
1.t.writeln; //<--Doesn't compile
1.test!(x=>x+1).writeln;
t(1).writeln;
}
```
On 6/14/22 3:35 PM, JG wrote:
Hi,
Is this a bug?
```d
import std;
template test(alias f) {
auto test(I)(I i) { return f(i); }
}
void main()
{
alias t = test!(x=>x+1);
1.t.writeln; //<--Doesn't compile
1.test!(x=>x+1).writeln;
t(1).writeln;
}
```
Not a bug. Local sym
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote:
I have [pretty simple code in my
library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47):
```d
alias CC = SumType!(AA,BB);
struct AA {}
struct BB
{
CC[] c;
}
private void ppp(T, Output)(au
On Monday, 13 June 2022 at 13:15:42 UTC, Steven Schveighoffer
wrote:
Possibly, but I don't close the handle. It goes back to a pool
to get reused.
Um. I need a (fresh) connection per CGI process. I wonder if
nowadays the TLS startup between the browser and the webserver
isn't at least one o
On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote:
No idea. The functions seems indeed to be exactly the same, so
I assume this is a DMD bug. It cannot be a bug in
`std.sumtype`, since that would trigger in both of the
templates.
This definitely triggers some bug in DMD because this `priva
I don't see what you see wrong with the code I wrote. It's
straightforward, obvious, and does the job I need it to do, in a way
that's not prone to future mistakes.
I explained why, but you don't agree with the explanation. That's OK, we
don't all have to write the same exact systems. D is a l
Hi,
I've been interested in conversion possibilities for a while. I
tried to convert a string containing numbers but with no success
in single digits. The only solution I found is to subtract 48
from the result:
```d
import std;
void main()
{
string str = "abc123";
str[3..$].to!int
On Wednesday, 15 June 2022 at 04:26:44 UTC, Salih Dincer wrote:
Hi,
I've been interested in conversion possibilities for a while.
I tried to convert a string containing numbers but with no
success in single digits. The only solution I found is to
subtract 48 from the result:
```d
import s
16 matches
Mail list logo