I have a two questions about calling C functions from D.
(1) When passing a D callback to a C function, is there a way to
write the code without having to prefix the callback declaration
with "extern(C)"?
It's not a big deal adding the prefix to the D function
declaration. It just seems odd
We would like to use vibe.d for a simple backend, but run into
strange behavior with HTTP request. The backend is simple: it
receives requests from clients and makes requests for some json
contents. Now, the code is only a vibe.d basic http server and a
sample http request from vibe.d example.
On Thursday, 25 June 2020 at 18:47:42 UTC, repr-man wrote:
struct ChunksOf(R)
{
Chunks!R iter;
this(R r, size_t width)
{
this.iter = r.chunks(width);
assert(is(typeof(iter) == Chunks!R));
}
}
This works, only if I change the declaration of x in main() to:
As an extension of my previous thread
(https://forum.dlang.org/thread/nupwljahyutnyxdvp...@forum.dlang.org), I wanted to ask about iterators in structs. I will start with the following code:
void main()
{
int[5] a = [0, 1, 2, 3, 4];
int[5] b = [5, 6, 7, 8, 9];
auto x =
Collection elements are accessed by ranges in D. Although both iterators
and ranges fundamentally do the same thing (access elements). More
accurately, ranges correspond to a pair iterators.
On 6/24/20 8:35 PM, repr-man wrote:
> auto func(R)(R r, size_t width)
> if(isRandomAccessRange!R)
> {
On Thursday, 25 June 2020 at 03:35:00 UTC, repr-man wrote:
This seems to have to do with the fact that all iterators
return their own unique type. Could someone help me understand
the reason behind this design and how to remedy my situation?
Ranges conform to well-defined interfaces.