On Saturday, 7 May 2022 at 02:29:59 UTC, Salih Dincer wrote:
On Friday, 6 May 2022 at 18:04:13 UTC, JG wrote:
```d
//...
struct Adder {
int a;
int opCall(int b) { return a+b; }
}
auto adder(int a) {
auto ret = Adder.init;
ret.a=a;
return ret;
}
void main() {
auto g =
On Friday, 6 May 2022 at 18:04:13 UTC, JG wrote:
```d
//...
struct Adder {
int a;
int opCall(int b) { return a+b; }
}
auto adder(int a) {
auto ret = Adder.init;
ret.a=a;
return ret;
}
void main() {
auto g = adder(5);
g(5).writeln; // 10
auto d = toDelegate!(int,
On Friday, 6 May 2022 at 18:35:40 UTC, Ali Çehreli wrote:
On 5/6/22 11:04, JG wrote:
> [...]
This is a segmentation fault. Reduced:
import std;
[...]
Hi, thanks. That was quite silly. (I was thinking the variable
lives to the end of scope of main but not thinking about that I
am passing
On 5/6/22 11:04, JG wrote:
> This isn't code to be used for anything (just understanding).
This is a segmentation fault. Reduced:
import std;
struct Delegate(A,B) {
B function(void* ptr, A a) f;
void* data;
B opCall(A a) {
return f(data,a);
}
}
auto toDelegate(A,
This isn't code to be used for anything (just understanding).
```d
import std;
struct Delegate(A,B) {
B function(void* ptr, A a) f;
void* data;
B opCall(A a) {
return f(data,a);
}
}
auto toDelegate(A, B,S)(S s) {
static B f(void* ptr, A a) {
return
Hey everyone, I'm new to D so bare with me please. I've been
trying to figure out what's up with the strange forward refernce
errors the compiler (DMD 2.060) is giving me. Here's a code
snippet that's generating a forward reference error:
public class AliasTestClass(alias func)
{
On 2012-10-14, 14:28, Martin wrote:
Hey everyone, I'm new to D so bare with me please. I've been trying to
figure out what's up with the strange forward refernce errors the
compiler (DMD 2.060) is giving me. Here's a code snippet that's
generating a forward reference error:
public class
On Sunday, 14 October 2012 at 12:58:24 UTC, Simen Kjaeraas wrote:
On 2012-10-14, 14:28, Martin wrote:
Hey everyone, I'm new to D so bare with me please. I've been
trying to figure out what's up with the strange forward
refernce errors the compiler (DMD 2.060) is giving me. Here's
a code