Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking reports
an error like this:
Error 42: Symbol Undefined
_D12relationaldb10interfaces21RÇëÜDBIÇêÿ35__T7loadRowTS6prefix÷6P¶ZÇêáMFAyaAS3std7variant18Çâ└8VÇåìNVki20ZÇëÅZÇûð
Essential
Hi guys,
here's my full code below.
My problem is that last "auto Y = X" assignment, that the
compiler won't accept:
yo.globalFunction.DirectStruct.IndirectStruct.indirectMemberFunc
cannot access frame of function yo.globalFunction
I was expecting X to be accessible from here.
Suprisingly, i
On Sunday, 25 June 2017 at 11:39:27 UTC, Andrew Chapman wrote:
Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking
reports an error like this:
Error 42: Symbol Undefined
_D12relationaldb10interfaces21RÇëÜDBIÇêÿ35__T7loadRowTS6prefi
On Sunday, 25 June 2017 at 13:04:32 UTC, Nicholas Wilson wrote:
On Sunday, 25 June 2017 at 11:39:27 UTC, Andrew Chapman wrote:
Hi guys, I'm a little confused as to whether D supports
interfaces with templates. I can compile OK, but linking
reports an error like this:
Error 42: Symbol Undefin
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
On Sunday, 25 June 2017 at 02:09:53 UTC, Adam D. Ruppe wrote:
On Sunday, 25 June 2017 at 02:05:35 UTC, unleashy wrote:
How would I call `addToBar` from C code?
You don't. Instead write it like:
struct Foo
{
int bar;
}
extern(C) void addToBar(Foo* foo, int what) {
foo.bar += what;
How would you solve this problem: do an optional function call
depending on some version(X). If version(X) is not defined, there
should be no call and no extra code at -O0.
```
{
...
foo(); // either compiles to a function call, or to _nothing_.
...
}
```
In C, you could do something like:
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
How would you solve this problem: do an optional function call
depending on some version(X). If version(X) is not defined,
there should be no call and no extra code at -O0.
```
{
...
foo(); // either compiles to a function call,
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
[...]
If version(X) is not defined, there should be no call and no
extra code at -O0.
[...]
In C, you could do something like:
```
#if X
void foo() {..}
#else
#define foo()
#endif
```
How would you do this in D?
By requi
On Sunday, 25 June 2017 at 13:32:57 UTC, Andrew Chapman wrote:
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
Yes, function templates in classes or interfaces are implicit
On Sunday, 25 June 2017 at 13:32:57 UTC, Andrew Chapman wrote:
I think you've answered the question with "You cannot have
unimplemented templates in interfaces". Thanks for the answer.
I'll rethink the way I'm doing this.
Cheers.
In your case you can probably use something along the lines o
On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
[...]
If version(X) is not defined, there should be no call and no
extra code at -O0.
[...]
In C, you could do something like:
```
#if X
void foo() {..}
#else
On Sunday, 25 June 2017 at 16:29:20 UTC, Anonymouse wrote:
Am I missing something, or can't you just version both the
function and the function ćall?
version(X)
void foo() { /* ... */ }
void main()
{
version(X)
{
foo();
}
}
I am hoping for something where "foo()" would
On Sunday, 25 June 2017 at 21:55:22 UTC, Johan Engelen wrote:
On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:
By requiring the compiler to inline the empty foo:
This won't work.
Yes, it does; comment out the call to `foo` and notice no change
in the assembly in my link.
On Sunday, 25 June 2017 at 22:23:44 UTC, Moritz Maxeiner wrote:
The solution obviously does *not* work if you change the
premise of your question after the fact by artificially
injecting instructions into all function bodies
I meant semantically no call. I am asking for a little more
imagin
On Sunday, 25 June 2017 at 22:53:07 UTC, Johan Engelen wrote:
I meant semantically no call.
In the existing language, I think version (or static if) at the
usage and definition points both is as good as you're going to
get.
unless you use a preprocessor lol
But the good news about version
I really like the std.concurrency
(https://dlang.org/phobos/std_concurrency.html) with spawn, send,
receive ...
Is there a builtin way to schedule core or an event after a delay (e.g.
in android:
https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable,
long)
I'm using the phobos "chain" function to iterate over a set of
string arrays. However, one of the variables is actually an
array of structs that each contain a string array. So I use
"map" to get a range of string arrays, but "chain" expects each
variable to be a string array, not a range of
Perhaps?
http://dlang.org/phobos/std_algorithm_iteration.html#.joiner
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
In C, you could do something like:
```
#if X
void foo() {..}
#else
#define foo()
#endif
```
Curious no one has mentionned it.
Just use alias.
version(X)
alias myFunc = impl1;
else
alias myFunc = impl2;
I do it a lo
On Mon, 2017-06-26 at 07:19 +0100, rikki cattermole via Digitalmars-d-
learn wrote:
> Perhaps?
> http://dlang.org/phobos/std_algorithm_iteration.html#.joiner
>
I think this is yet another case where if Phobos had flatMap life would
be a lot easier.
--
Russel.
===
21 matches
Mail list logo