www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Mixin and variable

reply "ElfQT" <dethjunk yahoo.com> writes:
<output>
Qnittest asm_rand
Qnittest Error: 4invalid UTF-8 sequence
</output>


<code>
private import std.stdio;


int main(char[][] args)
{
    printf("Main\n");
 return 0;
}

unittest
{
 mixin UnittestMixin;

 char[] m_file =  "asm_rand" /*__FILE__*/; char[] m_testcase = "Uff";

 Test1( m_file );
 Test2();

}

template UnittestMixin()
{
 char[] m_file = "xxx";

 void Test1(char[] c)
 {
  writefln("Qnittest %s", c);
 }

 void Test2()
 {
  Unittest.Test(m_file);
 }
}

class Unittest
{
 static void Test(char[] c)
 {
  writefln("Qnittest %s", c);
 }
}
</code>

<comment>
If I use __FILE__ in  a mixin, it will always contain the only one file name 
of the mixin declaration, not the place where it is included.
</comment> 
Sep 03 2005
parent reply =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ElfQT schrieb:
 <output>
 Qnittest asm_rand
 Qnittest Error: 4invalid UTF-8 sequence
 </output>


 <code>
 private import std.stdio;


 int main(char[][] args)
 {
     printf("Main\n");
  return 0;
 }

 unittest
 {
  mixin UnittestMixin;

  char[] m_file =  "asm_rand" /*__FILE__*/; char[] m_testcase = "Uff";

  Test1( m_file );
  Test2();

 }

 template UnittestMixin()
 {
  char[] m_file = "xxx";

  void Test1(char[] c)
  {
   writefln("Qnittest %s", c);
  }

  void Test2()
  {
   Unittest.Test(m_file);
  }
 }

 class Unittest
 {
  static void Test(char[] c)
  {
   writefln("Qnittest %s", c);
  }
 }
 </code>

Added to DStress as http://dstress.kuehne.cn/run/m/mixin_14_A.d http://dstress.kuehne.cn/run/m/mixin_14_B.d http://dstress.kuehne.cn/run/m/mixin_14_C.d http://dstress.kuehne.cn/run/m/mixin_14_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDGtb13w+/yD4P9tIRAlLeAJkBtQtCBzoaB21GhzfEo4aRA07ozQCghiGG +P4hY/IrChjEOMXJJQhYJ+M= =mxla -----END PGP SIGNATURE-----
Sep 04 2005
parent reply Bastiaan Veelo <Bastiaan.N.Veelo ntnu.no> writes:
Thomas Kühne wrote:
 
 Added to DStress as
 http://dstress.kuehne.cn/run/m/mixin_14_A.d
 http://dstress.kuehne.cn/run/m/mixin_14_B.d
 http://dstress.kuehne.cn/run/m/mixin_14_C.d
 http://dstress.kuehne.cn/run/m/mixin_14_D.d
 

What is the difference between A through D? Both A and B (but not C or D) appear on the webpage. Thanks, Bastiaan.
Sep 09 2005
next sibling parent Bastiaan Veelo <Bastiaan.N.Veelo ntnu.no> writes:
Bastiaan Veelo wrote:
 Thomas Kühne wrote:
 
 Added to DStress as
 http://dstress.kuehne.cn/run/m/mixin_14_A.d
 http://dstress.kuehne.cn/run/m/mixin_14_B.d
 http://dstress.kuehne.cn/run/m/mixin_14_C.d
 http://dstress.kuehne.cn/run/m/mixin_14_D.d

What is the difference between A through D? Both A and B (but not C or D) appear on the webpage. Thanks, Bastiaan.

Sorry, this should have been a reply to "AAs can't contain references to interfaces"...
Sep 09 2005
prev sibling parent Bastiaan Veelo <Bastiaan.N.Veelo ntnu.no> writes:
Bastiaan Veelo wrote:
 Thomas Kühne wrote:
 
 Added to DStress as
 http://dstress.kuehne.cn/run/m/mixin_14_A.d
 http://dstress.kuehne.cn/run/m/mixin_14_B.d
 http://dstress.kuehne.cn/run/m/mixin_14_C.d
 http://dstress.kuehne.cn/run/m/mixin_14_D.d

What is the difference between A through D? Both A and B (but not C or D) appear on the webpage. Thanks, Bastiaan.

Sorry, this should have been a reply to "AAs can't contain references to interfaces"...
Sep 09 2005