On Thursday, 14 October 2021 at 17:53:57 UTC, Tejas wrote:
Maybe DIP 1040 will automatically solve that?
last use of objects that is a copy gets elided into a move
That is what it states, so maybe this one time, the problem
will go away just by waiting?
It would be great, but still, if I
On 10/14/21 9:17 PM, jfondren wrote:
On Friday, 15 October 2021 at 03:54:17 UTC, Ali Çehreli wrote:
On 10/14/21 8:35 PM, jfondren wrote:
The book, "The Go Programming Language" has this simple goroutine
example:
Here is one that uses receiveTimeout and OwnerTerminated:
Very nice, replacing
On Friday, 15 October 2021 at 03:54:17 UTC, Ali Çehreli wrote:
On 10/14/21 8:35 PM, jfondren wrote:
The book, "The Go Programming Language" has this simple
goroutine example:
Here is one that uses receiveTimeout and OwnerTerminated:
Very nice, replacing Thread.sleep with receiveTimeout and
On 10/14/21 8:35 PM, jfondren wrote:
The book, "The Go Programming Language" has this simple goroutine example:
Here is one that uses receiveTimeout and OwnerTerminated:
import std.stdio;
import std.concurrency;
import core.thread;
void main() {
spawnLinked(&spinner, 100.msecs);
enum n =
The book, "The Go Programming Language" has this simple goroutine
example:
```go
func main() {
go spinner(100 * time.Millisecond)
const n = 45
fibN := fib(n) // slow
fmt.Printf("\rFibonacci(%d) = %d\n", n, fibN)
}
func spinner(delay time.Duration) {
for {
for _, r :=
On Thursday, 14 October 2021 at 15:29:13 UTC, MoonlightSentinel
wrote:
On Wednesday, 13 October 2021 at 20:02:05 UTC, Vindex wrote:
Is there a decomposition for tuples and other data structures?
No, but you can emulate it, e.g. by using AliasSeq:
```d
import std.meta : AliasSeq;
import std.ty
On Thursday, 14 October 2021 at 17:37:21 UTC, Paul Backus wrote:
On Thursday, 14 October 2021 at 16:53:17 UTC, Kostiantyn Tokar
wrote:
[...]
Poor test coverage. If you go through Phobos and test
everything with a non-copyable struct (`@disable this(this)`),
you will find that most templates
On Thursday, 14 October 2021 at 16:53:17 UTC, Kostiantyn Tokar
wrote:
Take a look at `Tuple`
[constructor](https://github.com/dlang/phobos/blob/4130a1176cdb6111b0c26c7c53702e10011ff067/std/typecons.d#L672).
```d
this(Types values)
{
field[] = values[];
}
```
Actual fields are constructed fro
Hello.
I'm concerned about D's move semantics and how Phobos supports
it. For example, `std.typecons.Tuple`.
```d
struct A
{
int i;
this(this) { writeln("Expensive copy"); }
}
void main()
{
auto t = Tuple!(A)(A(42));
}
```
This code produces 1 unnecessary copy. Argument is an rvalu
On Wednesday, 13 October 2021 at 20:02:05 UTC, Vindex wrote:
Is there a decomposition for tuples and other data structures?
No, but you can emulate it, e.g. by using AliasSeq:
```d
import std.meta : AliasSeq;
import std.typecons : tuple;
import std.stdio : writeln;
void main() {
int a;
On 10/14/21 7:58 AM, tastyminerals wrote:
The new `DMD v2.097.2` deprecated implicit null conversions
`std.typecons.Nullable!double.Nullable.get_`.
The deprecation warning tell you to `Please use .get explicitly.`.
Here is an example code that doesn't work with the new compiler anymore:
```
i
On 10/13/21 1:02 PM, Vindex wrote:
Is there a decomposition for tuples and other data structures?
For example,
```
auto t = tuple(1, "2");
auto (x, y) = t; // or auto (x, y) = t.expand;
```
No, D does not have this (yet?).
I thought there was a special case for tuples with foreach but I can't
On Thursday, 14 October 2021 at 11:58:29 UTC, tastyminerals wrote:
Here is an example code that doesn't work with the new compiler
anymore:
```
if (someValue.isNull)
```
Attempting to run the above throws:
```
Error: incompatible types for `(0) : (someValue)`: `int` and
`Nullable!int`
```
The new `DMD v2.097.2` deprecated implicit null conversions
`std.typecons.Nullable!double.Nullable.get_`.
The deprecation warning tell you to `Please use .get explicitly.`.
Here is an example code that doesn't work with the new compiler
anymore:
```
if (someValue.isNull)
```
Attempting to r
On Thursday, 14 October 2021 at 05:41:01 UTC, Tejas wrote:
On Wednesday, 13 October 2021 at 17:58:23 UTC, Jonathan Levi
wrote:
When dmd is passed the "-w" tag, it "treats warnings as
errors" but not with the "__traits(compiles)" expression. Is
this the intended action?
This code should compi
15 matches
Mail list logo