Re: Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 16:08:11 UTC, Exil wrote: On Wednesday, 29 May 2019 at 08:45:45 UTC, Andre Pany wrote: [...] I imagine __FILE__ is used where the code is defined, since it is defined in "a.d" that is what is used. If you want to know the file name of where it is used then you

Re: Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Exil via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 08:45:45 UTC, Andre Pany wrote: Hi, I have a module a.d --- struct TestClass { string name; string fileName; } TestClass[] testClasses; mixin template UnitTest() { private static string getFileName(string fileName = __FILE__) {

Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Andre Pany via Digitalmars-d-learn
Hi, I have a module a.d --- struct TestClass { string name; string fileName; } TestClass[] testClasses; mixin template UnitTest() { private static string getFileName(string fileName = __FILE__) { return fileName; } private static this() {

Re: Behavior of __FILE__ in mixin template

2016-06-22 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 17:52:26 UTC, Ali Çehreli wrote: On 06/22/2016 10:07 AM, Andre Pany wrote: > Hi, > > I thought a mixin template is copied into the place where the mixin > statement > exists and then the coding is evaluated. > This seems not to be true for __FILE__ Apparently its

Re: Behavior of __FILE__ in mixin template

2016-06-22 Thread Ali Çehreli via Digitalmars-d-learn
On 06/22/2016 10:07 AM, Andre Pany wrote: > Hi, > > I thought a mixin template is copied into the place where the mixin > statement > exists and then the coding is evaluated. > This seems not to be true for __FILE__ Apparently its the whole template that supports that. Is moving the 'file'

Behavior of __FILE__ in mixin template

2016-06-22 Thread Andre Pany via Digitalmars-d-learn
Hi, I thought a mixin template is copied into the place where the mixin statement exists and then the coding is evaluated. This seems not to be true for __FILE__ I have a module form, which has a class Form. This module also contains following mixin template mixin template formTemplate() {