On Tuesday, 28 August 2018 at 20:58:23 UTC, Alex wrote:
Isn't the problem, that inside a template a declaration is
expected, and not a foreach?
Boh, you're right. I guess I misunderstood mixin templates. Found
a way with a normap function though :p
void mapSelf(alias self, alias aa)() {
On Tuesday, 28 August 2018 at 20:37:05 UTC, Everlast wrote:
Also, the biggest complaint is that when we use [] attached to
a type it has a specific meaning as "an array of". e.g., int[]
means an array of int's.
But int[] a... then changes as we don't have an array of int's
any more but simply
On Tuesday, 28 August 2018 at 20:39:16 UTC, aliak wrote:
Hi,
I'm trying to do something similar to what Kotlin allows with
assigning to member variables from a map. The syntax is very
readable and looks like:
class User(val map: Map) {
val name: String by map
val age: Int by map
On Tuesday, 28 August 2018 at 19:40:36 UTC, Paul Backus wrote:
On Tuesday, 28 August 2018 at 19:09:38 UTC, Everlast wrote:
Yeah, I see the link paul posted. The actual syntax seems a
bit strange to me...
We don't do
A[] a
So it is not "logical".
foo(A...)(A a)
but if A is a specific t
Hi,
I'm trying to do something similar to what Kotlin allows with
assigning to member variables from a map. The syntax is very
readable and looks like:
class User(val map: Map) {
val name: String by map
val age: Int by map
}
So I'm trying to do something similar in D:
mixin temp
On Tuesday, 28 August 2018 at 19:09:38 UTC, Everlast wrote:
Yeah, I see the link paul posted. The actual syntax seems a bit
strange to me...
We don't do
A[] a
So it is not "logical".
foo(A...)(A a)
but if A is a specific type we must do
foo(int[] a ...)
The actual syntax then looks l
On Tuesday, 28 August 2018 at 19:09:38 UTC, Everlast wrote:
On Tuesday, 28 August 2018 at 12:00:50 UTC, bauss wrote:
On Sunday, 26 August 2018 at 02:26:58 UTC, Everlast wrote:
in fact, I'd rather see
void print(T)(T t, int... a)
You were actually close.
void print(T)(T t, int[] a ...);
Ye
On Tuesday, 28 August 2018 at 12:00:50 UTC, bauss wrote:
On Sunday, 26 August 2018 at 02:26:58 UTC, Everlast wrote:
in fact, I'd rather see
void print(T)(T t, int... a)
You were actually close.
void print(T)(T t, int[] a ...);
Yeah, I see the link paul posted. The actual syntax seems a bit
On Tuesday, 28 August 2018 at 13:27:28 UTC, Simen Kjærås wrote:
Now, as has been pointed out, that only work for
null-coalescing, not null-propagation. It seems writers of
Optional, Variant, SumType, and so on, have decided not to
support this out of the box, but rather wrap it separately,
lik
Hi all,
I have noticed that "protected static" doesn't work currently with
classes. In my case, I wanted to use "static immutable", but I have
tried regular static members and methods, and the same issue happens.
However, the puzzling part is that protected enums (which are a valid
workaround
On Tuesday, 28 August 2018 at 13:05:15 UTC, bauss wrote:
I'm not sure if there is a better way, but isInstanceOf
(std.traits) seems to work with a static foreach and a static
if.
template Qwerty(Values...)
{
static foreach (value; Values)
{
static if (!isInstanceOf!(Qaz, value)
On Monday, 27 August 2018 at 14:59:20 UTC, SG wrote:
On Monday, 27 August 2018 at 07:59:17 UTC, Simen Kjærås wrote:
That's the null propagation operator (?.). What SG asked for
is the null-coalescing operator (??). Of course, this can also
be implemented in D (albeit with a slight more horrible
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about
v
On Tuesday, 28 August 2018 at 13:05:15 UTC, bauss wrote:
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type
in "Va
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about
v
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about
v
Thanks for all your answers.
I'll have a look at the design and use casting if necessary.
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about values
of "type" or "Data" in "Qaz".
How to do it in D?
On Sunday, 26 August 2018 at 02:26:58 UTC, Everlast wrote:
in fact, I'd rather see
void print(T)(T t, int... a)
You were actually close.
void print(T)(T t, int[] a ...);
On Tuesday, 28 August 2018 at 10:48:20 UTC, Ivo wrote:
I'm writing a basic server program and I want to handle each
connection received in a new thread.
So here is the code I'm trying to produce:
while(true) {
auto client = socket.accept();
spawn(&handleConnection , client);
}
void ha
while(true) {
auto client = socket.accept();
spawn(&handleConnection, cast(shared)client);
}
void handleConnection(shared Socket sclient) {
Socket client=cast()sclient;
//do stuff like receive and send
}
Maybe http://libpipeline.nongnu.org/ can be an inspiration.
I'm writing a basic server program and I want to handle each
connection received in a new thread.
So here is the code I'm trying to produce:
while(true) {
auto client = socket.accept();
spawn(&handleConnection , client);
}
void handleConnection(Socket client) {
//do stuff like rece
On Saturday, 25 August 2018 at 13:33:58 UTC, SG wrote:
1) I program in C# and I'm wondering if there is something like
?? (Null-Coalescing Operator) in D? (I remember some proposals
in the past).
Another example:
https://github.com/aliak00/optional/blob/master/source/optional/optional.d#L340
On Tuesday, 28 August 2018 at 06:20:37 UTC, Sebastiaan Koppe
wrote:
On Tuesday, 28 August 2018 at 06:11:35 UTC, Jon Degenhardt
wrote:
The goal is to write the argument list once and use it to
create both the function and the Tuple alias. That way I could
create a large number of these function
On Tuesday, 28 August 2018 at 06:20:37 UTC, Sebastiaan Koppe
wrote:
On Tuesday, 28 August 2018 at 06:11:35 UTC, Jon Degenhardt
wrote:
The goal is to write the argument list once and use it to
create both the function and the Tuple alias. That way I could
create a large number of these function
26 matches
Mail list logo