On Monday, 20 September 2021 at 18:13:53 UTC, Steven
Schveighoffer wrote:
On 9/20/21 10:22 AM, Tejas wrote:
In case you still want to delete stuff deterministically
despite what Steve said, I suggest you make your `struct` a
reference and use `core.memory.__delete`(not recommended to
use this
On Tuesday, 21 September 2021 at 01:02:30 UTC, leikang wrote:
On Monday, 20 September 2021 at 21:51:32 UTC, russhy wrote:
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote:
Enter dmd lk01.d in vscode, the terminal displays zsh:
command not found: dmd, an error is reported, I don't kno
On Monday, 20 September 2021 at 20:02:24 UTC, NonNull wrote:
How do I write the type of a function so as to alias it, and
use that in an extern(C) declaration?
For example, how do I write the type of an external function
int main2(int argc, char** argv) {
//
}
?
This is not
int function
On 9/20/21 6:16 PM, rjkilpatrick wrote:
Essentially, I would like to write a template that calls the constructor
of the parent class or the constructor of the inherited class, depending
on its type.
...
Some kind of `return new this(...)` would be good, but that's not possible.
I think it
On Monday, 20 September 2021 at 21:51:32 UTC, russhy wrote:
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote:
Enter dmd lk01.d in vscode, the terminal displays zsh: command
not found: dmd, an error is reported, I don't know what the
problem is, can it only be run in /Users/mac1094/dm
On Monday, 20 September 2021 at 22:16:47 UTC, rjkilpatrick wrote:
auto opBinary(string op)(int rhs) const if (op == "+") {
return new Super(_a + rhs); // Creates of type Super
even when called from derived class
}
Make this
auto opBinary(string op, this This)(int rhs) ...
Essentially, I would like to write a template that calls the
constructor of the parent class or the constructor of the
inherited class, depending on its type.
```d
#!/usr/bin/env dub
/+ dub.sdl:
name "mwe"
+/
class Super {
private int _a;
this(){}
this(int a) {
_a =
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote:
Enter dmd lk01.d in vscode, the terminal displays zsh: command
not found: dmd, an error is reported, I don't know what the
problem is, can it only be run in /Users/mac1094/dmd2/osx/bin?
Keep in mind that if you have M1 machine, you c
My tkd GUI app started getting compiled with an outdated 8.5 Tk
framework version which gets shipped with command line tools:
`xcode-select --install`. As a result, the UI doesn't display
icons and is laggy. When you run the compiled tk app, you get a
notorious warning:
```
DEPRECATION WARNIN
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote:
Enter dmd lk01.d in vscode, the terminal displays zsh: command
not found: dmd, an error is reported, I don't know what the
problem is, can it only be run in /Users/mac1094/dmd2/osx/bin?
How have you installed dmd?
On Monday, 20 September 2021 at 15:33:23 UTC, Paul Backus wrote:
On Monday, 20 September 2021 at 11:21:28 UTC, surlymoor wrote:
The error in question...
```
Error: variable
`std.typecons.ReplaceTypeUnless!(isSumTypeInstance, This,
SumType!(Foo!(bar)), Foo!(bar)).F!(bar).replaceTemplateArgs`
t
On Monday, 20 September 2021 at 20:02:24 UTC, NonNull wrote:
How do I write the type of a function so as to alias it, and
use that in an extern(C) declaration?
For example, how do I write the type of an external function
int main2(int argc, char** argv) {
//
}
You can create an alias to
How do I write the type of a function so as to alias it, and use
that in an extern(C) declaration?
For example, how do I write the type of an external function
int main2(int argc, char** argv) {
//
}
?
This is not
int function(int, char**)
because this is the type of a function pointer
On 9/20/21 10:22 AM, Tejas wrote:
In case you still want to delete stuff deterministically despite what
Steve said, I suggest you make your `struct` a reference and use
`core.memory.__delete`(not recommended to use this carelessly, btw)
Do not call `__delete` here, use `destroy`. `__delete` wi
On 9/20/21 5:23 AM, Learner wrote:
I was expecting S instance dtor called
S is being destructed
If you are sure the element can be destroyed, you can call destroy():
import std.stdio;
enum someSpecialInitValue = 777;
struct S
{
int i = someSpecialInitValue;
this(int i)
{
this.i =
On Monday, 20 September 2021 at 15:56:44 UTC, Ferhat Kurtulmuş
wrote:
On Monday, 20 September 2021 at 15:45:08 UTC, Adam D Ruppe
wrote:
On Monday, 20 September 2021 at 15:35:02 UTC, Ferhat Kurtulmuş
wrote:
I thought it's stack-allocated and scoped.
It is.
But when I try to return a class ins
On Monday, 20 September 2021 at 15:45:08 UTC, Adam D Ruppe wrote:
On Monday, 20 September 2021 at 15:35:02 UTC, Ferhat Kurtulmuş
wrote:
I thought it's stack-allocated and scoped.
It is.
But when I try to return a class instance from a function, it
still works?
dmd only makes that an error
On Monday, 20 September 2021 at 15:35:02 UTC, Ferhat Kurtulmuş
wrote:
I thought it's stack-allocated and scoped.
It is.
But when I try to return a class instance from a function, it
still works?
dmd only makes that an error if you specify `@safe` and i think
`-dip1000`. Try adding one or b
I have made an owner type that wraps malloc'd pointers with
custom destroy functions from a C library and utilizes
`RefCounted` for safety. I would like to be able to use the owner
type `Memory` implicitly as its underlying pointer type via
`alias this`.
```
struct Memory(T, alias destroy)
if(
On Saturday, 18 September 2021 at 22:16:32 UTC, Adam D Ruppe
wrote:
On Saturday, 18 September 2021 at 15:38:38 UTC, rempas wrote:
I'm seeing in the page about "BeterC" and in the part about
the [retained
features](https://dlang.org/spec/betterc.html#retained), the
#11 says about "COM classes a
On Monday, 20 September 2021 at 11:21:28 UTC, surlymoor wrote:
The error in question...
```
Error: variable
`std.typecons.ReplaceTypeUnless!(isSumTypeInstance, This,
SumType!(Foo!(bar)), Foo!(bar)).F!(bar).replaceTemplateArgs`
type `void` is inferred from initializer `bar()`, and variables
ca
On Monday, 20 September 2021 at 14:03:09 UTC, Tejas wrote:
On Monday, 20 September 2021 at 13:48:01 UTC, Tejas wrote:
On Monday, 20 September 2021 at 12:23:00 UTC, Learner wrote:
[...]
I think it *is* being called:
```d
import std.stdio;
struct S
{
int a;
this(int param){
On Monday, 20 September 2021 at 13:48:01 UTC, Tejas wrote:
On Monday, 20 September 2021 at 12:23:00 UTC, Learner wrote:
[...]
I think it *is* being called:
```d
import std.stdio;
struct S
{
int a;
this(int param){
a = param;
}
~this()
{
On 9/20/21 8:23 AM, Learner wrote:
I was expecting something like going out of scope for that
```d
import std.stdio;
struct S
{
~this()
{
writeln("S is being destructed");
}
}
void main()
{
S[int] aa;
aa[1] = S();
aa.remove(1);
writeln("Why no dtor c
On Monday, 20 September 2021 at 12:23:00 UTC, Learner wrote:
I was expecting something like going out of scope for that
```(D)
import std.stdio;
struct S
{
~this()
{
writeln("S is being destructed");
}
}
void main()
{
S[int] aa;
aa[1] = S();
aa.remove(1);
On Monday, 20 September 2021 at 12:23:00 UTC, Learner wrote:
I was expecting something like going out of scope for that
```(D)
import std.stdio;
struct S
{
~this()
{
writeln("S is being destructed");
}
}
void main()
{
S[int] aa;
aa[1] = S();
aa.remove(1);
I was expecting something like going out of scope for that
```(D)
import std.stdio;
struct S
{
~this()
{
writeln("S is being destructed");
}
}
void main()
{
S[int] aa;
aa[1] = S();
aa.remove(1);
writeln("Why no dtor call on remove?");
}
I was expecting S
On Sunday, 19 September 2021 at 21:10:16 UTC, eugene wrote:
I rearranged the code of main() like this:
Similar rearrangement fixed the echo-client as well.
(I moved creation of Stopper to the very beginning of main())
I'm experiencing an error when instantiating `SumType` with an
aggregate template that itself is instantiated with a void
function. In other words...
```d
struct Foo(alias f) {}
// As the error implies, altering it to be non-void makes
everything copacetic~
void bar() {}
alias S = SumType!(Foo
Enter dmd lk01.d in vscode, the terminal displays zsh: command
not found: dmd, an error is reported, I don't know what the
problem is, can it only be run in /Users/mac1094/dmd2/osx/bin?
30 matches
Mail list logo