Re: Replacement for C++ Style Implicit casts?

2010-10-18 Thread Simen kjaeraas
Mike Chaten wrote: I was under the impression that alias this just was shorthand for Class Foo { int x; alias x this; } Foo foo = new Foo foo = 9; // foo.x = 9 Foo Foo = 9 // null.x =9; Not just. this would also work: int n = foo; // void bar( int n ) {} bar( foo ); Also, for opCast, doe

Re: implib crashing with .def files

2010-10-18 Thread Andrej Mitrovic
That's ok, using the DLL with implib works, but crashing is never nice. I don't think coffimplib is available for download however? On 10/18/10, Kagamin wrote: > Andrej Mitrovic Wrote: > >> Using: implib output.lib portaudio.def >> >> The usual Windows crash dialog appears. > > You should use co

Re: implib crashing with .def files

2010-10-18 Thread Kagamin
Andrej Mitrovic Wrote: > Using: implib output.lib portaudio.def > > The usual Windows crash dialog appears. You should use coffimplib instead and convert .lib import library of your dll.

Re: Replacement for C++ Style Implicit casts?

2010-10-18 Thread bearophile
Mike Chaten: > In C++ it is possible to declare a class as follows > class Foo { > Foo(int x) { } > } > You can then use that constructor to implicitly convert int to Foo. E.g > Foo x = 0; //equivalent to Foo(0) > > Is there a way in D to do an implicit or explicit conversion from an > integral t

Re: Replacement for C++ Style Implicit casts?

2010-10-18 Thread Denis Koroskin
On Mon, 18 Oct 2010 23:47:40 +0400, Mike Chaten wrote: In C++ it is possible to declare a class as follows class Foo { Foo(int x) { } } You can then use that constructor to implicitly convert int to Foo. E.g Foo x = 0; //equivalent to Foo(0) Is there a way in D to do an implicit or explicit co

Re: Replacement for C++ Style Implicit casts?

2010-10-18 Thread Mike Chaten
I was under the impression that alias this just was shorthand for Class Foo { int x; alias x this; } Foo foo = new Foo foo = 9; // foo.x = 9 Foo Foo = 9 // null.x =9; Also, for opCast, doesnt that only work for going from Foo to int and not the other way around? -Mike On Oct 18, 2010 3:55 PM, "S

Re: Replacement for C++ Style Implicit casts?

2010-10-18 Thread Steven Schveighoffer
On Mon, 18 Oct 2010 15:47:40 -0400, Mike Chaten wrote: In C++ it is possible to declare a class as follows class Foo { Foo(int x) { } } You can then use that constructor to implicitly convert int to Foo. E.g Foo x = 0; //equivalent to Foo(0) Is there a way in D to do an implicit or explicit co

Replacement for C++ Style Implicit casts?

2010-10-18 Thread Mike Chaten
In C++ it is possible to declare a class as follows class Foo { Foo(int x) { } } You can then use that constructor to implicitly convert int to Foo. E.g Foo x = 0; //equivalent to Foo(0) Is there a way in D to do an implicit or explicit conversion from an integral type to a class? -Mike

Re: Accessing anonymous reference inside with block

2010-10-18 Thread Andrej Mitrovic
Oops, the code came out a little fuzzy, here's the fixed one: http://pastebin.com/kiXPeQLB On 10/18/10, Andrej Mitrovic wrote: > Here's an example from DFL where I'm using an anonymous Scintilla > object which is a subclass of a text editing widget in DFL (just > another window subclass), but be

Re: Accessing anonymous reference inside with block

2010-10-18 Thread Andrej Mitrovic
Here's an example from DFL where I'm using an anonymous Scintilla object which is a subclass of a text editing widget in DFL (just another window subclass), but behind the scenes it actually loads the Scintilla DLL and behaves like a normal DFL text editing widget: http://pastebin.com/YAduPRtF Wh

Accessing anonymous reference inside with block

2010-10-18 Thread Stanislav Blinov
15.10.2010 19:43, Andrej Mitrovic wrote: Related: A nice alternative for quickly using anonymous objects is using the with statement, e.g.: with (new Foo) { foo(); // ... more code } And after the with block the object doesn't exist anymore. Or you could bind it to some internal refe

Re: Calling D function from C

2010-10-18 Thread Emil Madsen
Hopefully one could use printf, and tbh I dont like the hole garbage collector thingy :) 2010/10/12 Denis Koroskin <2kor...@gmail.com> > On Tue, 12 Oct 2010 11:46:39 +0400, Emil Madsen wrote: > > wouldn't compiling, without garbage collector help too? >> >> 2010/10/12 Denis Koroskin <2kor...@gm