Can I get caller name?

2014-09-26 Thread AsmMan via Digitalmars-d-learn
for debugging purposes, I need to get the caller name. Is it possible? if so, how do I do this? void foo() { baa(); } void baa() { wrilten(caller_name()); // foo } I know I could create an extra parameter and pass the current function name as argument but it isn't a possibility for now.

Re: Can I get caller name?

2014-09-26 Thread ketmar via Digitalmars-d-learn
On Fri, 26 Sep 2014 05:59:32 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: for debugging purposes, I need to get the caller name. Is it possible? if so, how do I do this? use debugger? or parse debugging info and do stackwalk. signature.asc Description: PGP

Re: Can I get caller name?

2014-09-26 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 26 September 2014 at 05:59:33 UTC, AsmMan wrote: for debugging purposes, I need to get the caller name. Is it possible? if so, how do I do this? void foo() { baa(); } void baa() { wrilten(caller_name()); // foo } I know I could create an extra parameter and pass the current

Re: [static] foreach scope, template declaration ?

2014-09-26 Thread via Digitalmars-d-learn
On Thursday, 25 September 2014 at 23:37:11 UTC, Ali Çehreli wrote: Surprisingly, that indicates that anySatisfy did instantiate CmpName with all three string values, meaning that perhaps we don't have shortcut behavior for 'bool' eponymous templates. Yes, that's the case (not just for

Twitter link in the homepage is broken

2014-09-26 Thread Ledd via Digitalmars-d-learn
https://twitter.com/#search?q=%23d_lang this is the URL for the Twitter link in the menu on the left side of the homepage, it doesn't work, this can be fixed with https://twitter.com/hashtag/d_lang or even https://twitter.com/hashtag/d_lang?mode=photos to restrict the search to photos, but

Re: Twitter link in the homepage is broken

2014-09-26 Thread Ledd via Digitalmars-d-learn
On Friday, 26 September 2014 at 10:36:52 UTC, Ledd wrote: https://twitter.com/#search?q=%23d_lang this is the URL for the Twitter link in the menu on the left side of the homepage, it doesn't work, this can be fixed with https://twitter.com/hashtag/d_lang or even

Re: [static] foreach scope, template declaration ?

2014-09-26 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 25 September 2014 at 23:08:53 UTC, SlomoTheBrave wrote: a way around this is not to use anySatisfy nor the template, for example this works as expected: [...] My problem is that in this example, attributes are in the same order as the parameter. But this come from a code

Object.factory from shared libraries

2014-09-26 Thread krzaq via Digitalmars-d-learn
I'd like to extend my program's functionality from plugins, that'd be loaded by name (or not) as requested by the config file. Is it possible to throw in a few dlls/sos implementing those new modules into a directory and hope that they will be all loaded and available to Object.factory in the

Re: Object.factory from shared libraries

2014-09-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 26/09/14 14:37, krzaq wrote: I'd like to extend my program's functionality from plugins, that'd be loaded by name (or not) as requested by the config file. Is it possible to throw in a few dlls/sos implementing those new modules into a directory and hope that they will be all loaded and

Re: Object.factory from shared libraries

2014-09-26 Thread krzaq via Digitalmars-d-learn
On Friday, 26 September 2014 at 14:14:05 UTC, Jacob Carlborg wrote: On 26/09/14 14:37, krzaq wrote: I'd like to extend my program's functionality from plugins, that'd be loaded by name (or not) as requested by the config file. Is it possible to throw in a few dlls/sos implementing those new

Re: Object.factory from shared libraries

2014-09-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2014-09-26 16:24, krzaq wrote: That would be satisfactory to me, except for the linux-only part. In that case, I think I'll simply try to call filename() as the factory function in each library - that should work everywhere, right? Dynamic libraries only work properly on Linux. This has

Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread Olivier Leduc via Digitalmars-d-learn
Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the exposed functions inside the C++ program from a D dynamic library? Is

Re: Can I get caller name?

2014-09-26 Thread AsmMan via Digitalmars-d-learn
Thanks guys!

Re: Object.factory from shared libraries

2014-09-26 Thread Cliff via Digitalmars-d-learn
On Friday, 26 September 2014 at 15:45:11 UTC, Jacob Carlborg wrote: On 2014-09-26 16:24, krzaq wrote: That would be satisfactory to me, except for the linux-only part. In that case, I think I'll simply try to call filename() as the factory function in each library - that should work

Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread AsmMan via Digitalmars-d-learn
I know I can combine it by making an extra variable plus a property like this: class Foo { private int a_; void do_something1() { a_ = baa(); } void do_something2() { if(cond) a_ = baa2(); } @property int a() { return a; } } This is the C#'s to do which

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 26 September 2014 at 17:16:04 UTC, AsmMan wrote: I know I can combine it by making an extra variable plus a property like this: class Foo { private int a_; void do_something1() { a_ = baa(); } void do_something2() { if(cond) a_ = baa2(); } @property int

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread Ali Çehreli via Digitalmars-d-learn
On 09/26/2014 10:16 AM, AsmMan wrote: I know I can combine it by making an extra variable plus a property like this: That's the proper way of doing it in D. If it's too much work, it is possible to take advantage of mixins to reduce the boilerplate. I found the following code among my D

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread via Digitalmars-d-learn
On Friday, 26 September 2014 at 17:16:04 UTC, AsmMan wrote: I know I can combine it by making an extra variable plus a property like this: class Foo { private int a_; void do_something1() { a_ = baa(); } void do_something2() { if(cond) a_ = baa2(); } @property int

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread bearophile via Digitalmars-d-learn
Marc Schütz: Alternatively, you could create a union with a private and a public member with the same types, but I wouldn't recommend it. Besides, the members would need to have different names: class Foo { union { private int a; public int b; }

Re: Does D has C#'s string.Empty?

2014-09-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 8:24 PM, AsmMan wrote: On Thursday, 25 September 2014 at 12:43:57 UTC, Steven Schveighoffer wrote: On 9/25/14 2:41 AM, SlomoTheBrave wrote: On Thursday, 25 September 2014 at 05:29:37 UTC, AsmMan wrote: Does D has C#'s string.Empty? string.init ? string a; a =

Re: A few questions regarding GC.malloc

2014-09-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 6:03 PM, Sean Kelly wrote: On Thursday, 25 September 2014 at 21:43:53 UTC, monarch_dodra wrote: On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby wrote: What does BlkAttr.FINALIZE do when used in the GC.malloc call? I have no idea. I think its for classes though,

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread via Digitalmars-d-learn
On Friday, 26 September 2014 at 17:52:58 UTC, bearophile wrote: Marc Schütz: Alternatively, you could create a union with a private and a public member with the same types, but I wouldn't recommend it. Besides, the members would need to have different names: class Foo { union {

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/26/14 1:36 PM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: Alternatively, you could create a union with a private and a public member with the same types, but I wouldn't recommend it. Besides, the members would need to have different names: class Foo { union {

Re: A few questions regarding GC.malloc

2014-09-26 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 26 September 2014 at 18:03:40 UTC, Steven Schveighoffer wrote: On 9/25/14 6:03 PM, Sean Kelly wrote: On Thursday, 25 September 2014 at 21:43:53 UTC, monarch_dodra wrote: On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby wrote: What does BlkAttr.FINALIZE do when used in

Re: A few questions regarding GC.malloc

2014-09-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/26/14 3:24 PM, monarch_dodra wrote: On Friday, 26 September 2014 at 18:03:40 UTC, Steven Schveighoffer wrote: On 9/25/14 6:03 PM, Sean Kelly wrote: On Thursday, 25 September 2014 at 21:43:53 UTC, monarch_dodra wrote: On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby wrote:

Re: Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 16:43:30 UTC, Olivier Leduc wrote: Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the

Re: Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread John Colvin via Digitalmars-d-learn
On Friday, 26 September 2014 at 16:43:30 UTC, Olivier Leduc wrote: Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the

Re: Dynamically loading a D dynamic library from a c++ program

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 16:43:30 UTC, Olivier Leduc wrote: Hello, I need to use a C++ SDK to create a plugin an existing closed source c++ application and I would like to know if its possible to use D for that task. Would is be possible to port the SDK header files and call the

Re: with (auto p = new ...)

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Tuesday, 23 September 2014 at 15:19:59 UTC, Andre wrote: Hi, I just wonder why with (auto p = new ...) is not working. It would be some syntax sugar in this scenario: with (auto p = new Panel()) { parent = this; text = bla;

Re: with (auto p = new ...)

2014-09-26 Thread Freddy via Digitalmars-d-learn
On Friday, 26 September 2014 at 19:59:56 UTC, Freddy wrote: On Tuesday, 23 September 2014 at 15:19:59 UTC, Andre wrote: Hi, I just wonder why with (auto p = new ...) is not working. It would be some syntax sugar in this scenario: with (auto p = new Panel()) {

Re: [static] foreach scope, template declaration ?

2014-09-26 Thread SlomoTheBrave via Digitalmars-d-learn
On Friday, 26 September 2014 at 11:16:01 UTC, Mathias LANG wrote: On Thursday, 25 September 2014 at 23:08:53 UTC, SlomoTheBrave wrote: a way around this is not to use anySatisfy nor the template, for example this works as expected: [...] My problem is that in this example, attributes are