On Thursday, 26 June 2025 at 03:55:03 UTC, Jonathan M Davis wrote:
[...]
Thanks for these wonderful explanations ! A const @safe nothrow
toHash indeed solved this.
When trying to use Nullable with a struct containing an
overlapping pointer:
```D
import std;
struct S
{
union
{
long foo;
int[] bar;
}
}
void main()
{
Nullable!S s;
}
```
I get this warning:
```
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(3820):
On Wednesday, 5 February 2025 at 01:20:07 UTC, Jonathan M Davis
wrote:
Note that it talks about the "initial inferred return type",
whereas your function doesn't have an initial inferred return
type, because it fails to compile when determining the return
type. So, while the spec doesn't expand
Basically the same question than
https://forum.dlang.org/post/aoltazzfmnztsyatf...@forum.dlang.org
but with functions/delegates and inferred return types:
``` D
interface I {
bool check();
}
class A : I {
bool check() =>true;
}
class B : I {
bool check() =>false;
}
void
``` D
import std;
void main()
{
auto sourceName = deleteme ~ "source";
auto source = File(sourceName, "w");
source.write("source");
copy(sourceName, "/dev/null");
}
```
The copy to /dev/null fails :
`std.file.FileException@std/file.d(4348): /dev/null: Invalid
argument`, which
On Tuesday, 7 January 2025 at 17:55:50 UTC, sfp wrote:
File `meson.build`:
```
project('unittest', 'd')
mainlib = library('mainlib', ['blah.d'])
executable('maintest', ['main.d'], link_with: [mainlib],
d_unittest: true)
```
Your first version is indeed wrong because the library is not
comp
On Sunday, 5 January 2025 at 23:52:24 UTC, sfp wrote:
Anyone have a good way of yanking out all `unittest { ... }`
blocks from a library compiled using Meson? It would be nice to
approximate what dub does.
Meson has mentions this trick in its help docs
(https://mesonbuild.com/D.html#using-emb
Hello
I believe std.functional.partial can only apply to the first
argument.
Is there an equivalent for the Nth argument ?
Something like :
``` D
int fun(int a, int b) { return a - b; }
// create a function with the argument n°1 being equal to 5
// fun5 = fun(a, 5);
alias fun5 = partialN!(fu
On Wednesday, 3 January 2024 at 17:44:00 UTC, H. S. Teoh wrote:
On Wed, Jan 03, 2024 at 04:50:57PM +, axricard via
Digitalmars-d-learn wrote:
I have an interface that is implemented by many classes, and I
want to pick one of these implementations at random. There are
two more constraints
I have an interface that is implemented by many classes, and I
want to pick one of these implementations at random. There are
two more constraints : first the distribution is not uniform, all
classes can define the chance they have to be picked (this is
reflected by the function 'weight()' belo
On Monday, 19 June 2023 at 16:43:30 UTC, Steven Schveighoffer
wrote:
In general, the language does not guarantee when the GC will
collect your item.
In this specific case, most likely it's a stale register or
stack reference. One way I usually use to ensure such things is
to call a function
On Monday, 19 June 2023 at 16:43:30 UTC, Steven Schveighoffer
wrote:
In general, the language does not guarantee when the GC will
collect your item.
In this specific case, most likely it's a stale register or
stack reference. One way I usually use to ensure such things is
to call a function t
I'm doing some experiments with ldc2 GC, by instrumenting it and
printing basic information (what is allocated and freed)
My first tests are made on this sample :
```
cat test2.d
import core.memory;
class Bar { int bar; }
class Foo {
this()
{
this.bar = new Bar;
}
Bar bar;
}
13 matches
Mail list logo