Re: C++ parser

2013-05-22 Thread Igor Stepanov
I'm not sure on how to best bind C++ code to D. D can handle some parts of the C++ ABI, like classes and virtual functions. dlang.org contains some information: Now extern(C++) interface allow to access to virtual and non-virtual (with final annotation) methods, static methods. After my pull

Re: C++ constructors, destructors and operator access

2013-05-20 Thread Igor Stepanov
Mapping constructors is complicated... Operator overloads are much worse, they just don't all map. You have misunderstood me. I spoke out against the mapping. I spoke only about access. For example if we automatically generate a binding extern(C++) interface we can add a special methods to

Re: C++ constructors, destructors and operator access

2013-05-20 Thread Igor Stepanov
On Monday, 20 May 2013 at 20:13:47 UTC, nazriel wrote: On Monday, 20 May 2013 at 20:11:27 UTC, nazriel wrote: On Saturday, 18 May 2013 at 22:23:51 UTC, Igor Stepanov wrote: At the current time D have powerful mechanism of access to C++ classes. For access to methods of C++ classes (virtual

Re: C++ constructors, destructors and operator access

2013-05-19 Thread Igor Stepanov
No. Ok. As I know, there is running process to moving DMD front-end from C++ to D. As I remember, process expect to be gradual. Thus I the same moment will be C++ classes and D classes in the frontend. How you are planning create new C++ objects from D? Are you planning add to all classes

Re: C++ constructors, destructors and operator access

2013-05-19 Thread Igor Stepanov
Is this mean, that D functions will _not_ create C++ objects with new? For example: You have moved parser to D, but you haven't moved expressions to D yet. And you want to create new Expression object in parser (in D code), but Expression class defined in C++. What will you do in this case?

Re: C++ constructors, destructors and operator access

2013-05-19 Thread Igor Stepanov
On Sunday, 19 May 2013 at 13:56:56 UTC, Daniel Murphy wrote: Igor Stepanov wazar.leoll...@yahoo.com wrote in message news:wuevxraaffhaaceap...@forum.dlang.org... Is this mean, that D functions will _not_ create C++ objects with new? For example: You have moved parser to D, but you haven't

Re: QtD fails to build on Arch Linux

2013-05-18 Thread Igor Stepanov
On Saturday, 18 May 2013 at 17:24:21 UTC, Tyler Jameson Little wrote: I'm on 64-bit, so I've used the 64-bit patch [1] on bitbucket to get the compile started. I get a lot of these errors: [ 3%] Building CXX object CMakeFiles/cpp_core.dir/cpp/qt_core/QAbstractItemModel_shell.cpp.o

C++ constructors, destructors and operator access

2013-05-18 Thread Igor Stepanov
At the current time D have powerful mechanism of access to C++ classes. For access to methods of C++ classes (virtual and not) we can use extern(C++) interface. //С++ class CPPTest1 { int a; int b; public: virtual int boom(); int fun(); static int gun();

Re: C++ constructors, destructors and operator access

2013-05-18 Thread Igor Stepanov
On Saturday, 18 May 2013 at 22:55:34 UTC, Ali Çehreli wrote: On 05/18/2013 03:23 PM, Igor Stepanov wrote: natural C++ mangle That's part of the problem: C++ name mangling is not standardized. Ali But D compilers are using C++ mangle for extern(C++) functions now. I think, this trouble

Re: [challenge] Linker surgery

2013-05-17 Thread Igor Stepanov
On Friday, 17 May 2013 at 17:57:54 UTC, Rainer Schuetze wrote: On 17.05.2013 14:29, Dmitry Olshansky wrote: 15-May-2013 04:17, IgorStepanov пишет: Do this table linked, if you remove all functions, which use it? Thanks for this try, but they DO link in always. And I believe this is a key

Re: [challenge] Linker surgery

2013-05-17 Thread Igor Stepanov
And how then I would use these tables if even importing these modules then pulls in the data? without import with pragma(mangle) help. But this dark linker magic no much better you template solution.

Re: Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

2013-05-17 Thread Igor Stepanov
On Friday, 17 May 2013 at 22:45:01 UTC, Timothee Cour wrote: Although I agree that having a default constructor would be convenient, I think the problem is that S.init should be known at compile time by the spec. Maybe we could support the following syntax, with a static this instead of

Re: [challenge] Linker surgery

2013-05-17 Thread Igor Stepanov
module fmod; public immutable int[] fable = [1,2,3]; module mod; //import fmod; int foo(int i) { pragma(mangle, _D4fmod5fableyAi) extern immutable int[] fable; return fable[i]; }

Re: Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

2013-05-17 Thread Igor Stepanov
When programmer see constructor, he think that it will be evaluated each time when he create a new object. This code will seem obvious for any C++ coder. And this coder will be deceived. If we'll add default constructor to structs, we'll must safe of illusion, that constructor is called any

Re: Why extern variables and functions within template/struct/class have a D mangling

2013-05-09 Thread Igor Stepanov
On Wednesday, 8 May 2013 at 19:14:14 UTC, Andrej Mitrovic wrote: On 5/8/13, Dicebot m.stras...@gmail.com wrote: Well, pardon me, I probably have exceeded my allowed daily rant limit :) Don't worry, and I agree with you. But I think it's probably too late to actually change what a linkage

Why extern variables and functions within template/struct/class have a D mangling

2013-05-07 Thread Igor Stepanov
Is it correct? When I wrote next code: template Extern(string s) { mixin(static extern(C) extern int ~s~;~ alias Extern = ~s~;); } void main() { writeln(Extern!(xxx)); } I get error message undefined reference to `_D1a24__T6ExternVAyaa3_787878Z3xxxi', when I expect to get undefined

Re: Why extern variables and functions within template/struct/class have a D mangling

2013-05-07 Thread Igor Stepanov
May be I need to fix that issue? What about functions? struct Foo { extern(C) void bar() { } } Is it good to set bar mangling to bar?

immuable method address and export method address.

2013-05-05 Thread Igor Stepanov
Hello, I've two simple questions: 1. I have a structure: struct Foo { public int bar() const {return 0;} public int bar() immutable {return 1;} } How can I get immutable bar address? When I've wrote next code I've got a const bar address. Is it a bug? void main() { immutable Foo

Re: Help with a DMD patch

2013-03-16 Thread Igor Stepanov
What do the lines el_combine? I do not see them in the code structure comparison.

Re: Help with a DMD patch

2013-03-16 Thread Igor Stepanov
On Saturday, 16 March 2013 at 21:21:51 UTC, Vladimir Panteleev wrote: On Saturday, 16 March 2013 at 21:15:32 UTC, Igor Stepanov wrote: What do the lines el_combine? I do not see them in the code structure comparison. Greetings Igor, The el_combine calls are supposed to ensure correct order

Re: Help with a DMD patch

2013-03-16 Thread Igor Stepanov
On Saturday, 16 March 2013 at 21:49:33 UTC, Vladimir Panteleev wrote: On Saturday, 16 March 2013 at 21:42:31 UTC, Igor Stepanov wrote: On Saturday, 16 March 2013 at 21:21:51 UTC, Vladimir Panteleev wrote: On Saturday, 16 March 2013 at 21:15:32 UTC, Igor Stepanov wrote: What do the lines

Re: template this parameters for constructors

2013-02-20 Thread Igor Stepanov
What about template this for compile-time constructing of structs (classes?)? e.g. struct BigDecimal { this(string arg) { *this = str2Dec(arg); } template this(string arg) { enum this = str2Dec(arg); } static BigDecimal str2Dec(string arg) //can be evaluated at compile

Re: Russian TDPL is available for orders

2012-04-04 Thread Igor Stepanov
The ones I recall in chapter 13 (and the only available for preview): с. 471 ...вплоть до массовой памяти лучше уж дисковой, звучит проще и сомнений меньше. Все таки имелась в виду не дисковая память, а ОЗУ. Можно ли назвать ее регулярной? на с.474 есть просто отличное предложение: По

Instantiate the template class method

2012-03-24 Thread Igor Stepanov
Hi! I engaged in addition to dmd with runtime reflection and there was a problem: If we have any template class, the real instantiated only those methods that are used. And to сonstruct the runtime reflection, I need to instantiate the other methods. And here is a question: how to do it. I write