Re: rehabilitating Juno

2014-06-21 Thread simendsjo via Digitalmars-d-learn
On 06/21/2014 06:40 AM, Jesse Phillips wrote: On Thursday, 19 June 2014 at 15:24:41 UTC, Jesse Phillips wrote: Once I get some examples compiling again in 32bit, it should be easier for you to play around with COM in D. I've pushed changes which get the library building and examples working.

Re: C structs

2014-06-21 Thread Artur Skawina via Digitalmars-d-learn
On 06/20/14 14:42, Dicebot via Digitalmars-d-learn wrote: On Friday, 20 June 2014 at 12:17:22 UTC, Johann Lermer wrote: So, why is there no init routine for the rectangle? There's only one for the matrix. That needs actually building deimos cairo and checking symbols in object files so I

Re: template mixins for boilerplate

2014-06-21 Thread Artur Skawina via Digitalmars-d-learn
On 06/21/14 05:32, Paul D Anderson via Digitalmars-d-learn wrote: I can't use a template mixin: mixin template Function(string name) { const char[] Function = public static int ~ name ~ () { return other.module. ~ name ~; }; } Error: mixin templates are not regular templates.

Re: template mixins for boilerplate

2014-06-21 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 21 June 2014 at 11:12:18 UTC, Artur Skawina via Digitalmars-d-learn wrote: On 06/21/14 05:32, Paul D Anderson via Digitalmars-d-learn wrote: I can't use a template mixin: mixin template Function(string name) { const char[] Function = public static int ~ name ~ () { return

Re: template mixins for boilerplate

2014-06-21 Thread Philippe Sigaud via Digitalmars-d-learn
Out of curiosity, why use a mixin template containing a string mixin instead of, well, directly injecting a string mixin in your struct, with a function?

Re: template mixins for boilerplate

2014-06-21 Thread Dicebot via Digitalmars-d-learn
On Saturday, 21 June 2014 at 13:45:14 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: Out of curiosity, why use a mixin template containing a string mixin instead of, well, directly injecting a string mixin in your struct, with a function? Hiding non-hygienic implementation behind a more

Re: rehabilitating Juno

2014-06-21 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 21 June 2014 at 10:26:57 UTC, simendsjo wrote: This is great. I used Juno back in 2007 for working with Excel, and it worked great. Nice to see the library getting an update for D2. I remember seeing some slides on another COM library for D2 a while ago. Was that effort ever

Re: Working on a library: request for code review

2014-06-21 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 20 June 2014 at 11:15:20 UTC, Mike wrote: Do you think it's ready for a v0.1 release? It be willing to add it to dub if it passes general D coding stardards. Sure, go for it :). Dub package versioning should be done using SemVer so there are some restrictions on how to number a

Re: template mixins for boilerplate

2014-06-21 Thread Philippe Sigaud via Digitalmars-d-learn
On Sat, Jun 21, 2014 at 4:24 PM, Dicebot via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Saturday, 21 June 2014 at 13:45:14 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: Out of curiosity, why use a mixin template containing a string mixin instead of, well, directly

assocArray.get(key, default) exists?

2014-06-21 Thread Paul via Digitalmars-d-learn
IS there such method get(key, default) for associative arrays, like in Python?

Re: assocArray.get(key, default) exists?

2014-06-21 Thread Andrej Mitrovic via Digitalmars-d-learn
On Saturday, June 21, 2014, Paul via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: IS there such method get(key, default) for associative arrays, like in Python? I think it's named getDefault, try that.

Re: enum functions

2014-06-21 Thread Andrej Mitrovic via Digitalmars-d-learn
On Saturday, June 21, 2014, Paul D Anderson via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Does enum have any effect on functions? I think that's just a parser bug.

Re: assocArray.get(key, default) exists?

2014-06-21 Thread bearophile via Digitalmars-d-learn
Paul: IS there such method get(key, default) for associative arrays, like in Python? Try it. Bye, bearophile

What is the correct way to forward method calls to the struct field?

2014-06-21 Thread monnoroch via Digitalmars-d-learn
I tried this: struct S { R opDispatch(string name, R, Args...)(Args args) { return mixin((*iface). ~ name)(iface, args); } SomeT ** iface; } But then val.foo(1, 2) gives me no property 'foo' for type 'S'. I've seen the template solution: struct S {

Re: What is the correct way to forward method calls to the struct field?

2014-06-21 Thread monnoroch via Digitalmars-d-learn
Actyaly, last variant didn't work either: i was testing it inside S like ifc.foo(1), so UFCS kiked in, not alias this.

Re: assocArray.get(key, default) exists?

2014-06-21 Thread Paul via Digitalmars-d-learn
On Saturday, 21 June 2014 at 18:14:15 UTC, bearophile wrote: Paul: IS there such method get(key, default) for associative arrays, like in Python? Try it. Bye, bearophile Wow! Thank you! It exists. Excuse my silly question :)

Re: What is the correct way to forward method calls to the struct field?

2014-06-21 Thread monnoroch via Digitalmars-d-learn
On Saturday, 21 June 2014 at 18:16:17 UTC, monnoroch wrote: Actyaly, last variant didn't work either: i was testing it inside S like ifc.foo(1), so UFCS kiked in, not alias this. Oh, my bad, alias impl this; actually did work. But the first argument problem still holds.

Re: Some kind of RPC exists for D?

2014-06-21 Thread Paul via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 19:24:03 UTC, Bienlein wrote: Hello, I'm looking for a way to do some kind of RPC in D. Some way of being able to say aFoo.bar(int i, ...) with receiver object and method being marshalled at the sender's site and being unmarshalled and invoked at the receiver's

opAssign() calls members' postblits?

2014-06-21 Thread via Digitalmars-d-learn
import std.stdio; struct A { this(this) { writeln(A.this(this)); } B b1, b2; } struct B { this(this) { writeln(B.this(this)); } } void main() { A a, b; a = b; } This outputs:

Re: template mixins for boilerplate

2014-06-21 Thread Artur Skawina via Digitalmars-d-learn
On 06/21/14 18:01, Philippe Sigaud via Digitalmars-d-learn wrote: In what way is a template more reliable than the equivalent function? mixin template Function(string name) { mixin(public static int ~ name ~ () { return other.module. ~ name ~; }); } struct S { mixin

Re: opAssign() calls members' postblits?

2014-06-21 Thread Ali Çehreli via Digitalmars-d-learn
On 06/21/2014 11:56 AM, Marc Schütz schue...@gmx.net wrote: import std.stdio; struct A { this(this) { writeln(A.this(this)); } B b1, b2; } struct B { this(this) { writeln(B.this(this)); }

Re: What is the correct way to forward method calls to the struct field?

2014-06-21 Thread Philippe Sigaud via Digitalmars-d-learn
You can use 'auto' to let the compiler deduce the return type. Here I use 'foo' which returns an int and 'bar', which returns void. struct SomeT { int foo(double d) { return 0;} void bar(double d) { return;} } struct S { auto /* here */ opDispatch(string name, Args...)(Args

Re: template mixins for boilerplate

2014-06-21 Thread Dicebot via Digitalmars-d-learn
Apart from what Artur has mentioned template mixins also give you opportunity to do qualified injection in case generated symbols conflict with existing ones: class A { void foo() {} mixin(void foo() {}); // error, need to add manual namespace wrapper mixin func!foo Sub; // does