[std.database] at compile time

bls bizprac at orange.fr
Sat Oct 15 17:16:27 PDT 2011


Am 16.10.2011 00:09, schrieb Don:
> It's a totally different situation from Nemerle, which has the luxury of
> restricting itself to systems with a .net JIT compiler.

What about Compiler Hooks (enable LanguageXYZ  to D Translation)
Sure, strange idea but IMHO worth a second look. Consider that language 
_SQL_ will be translated into D at compile-time.

void GetCustomersInParis(ref RowSet lhs_rs)
{

   // Compiler Hook, call SQL2DTranslator.
   SQL
    {
  	<DVALUE> lhs_rs = SELECT * FROM CUSTOMER WHERE CITY = "Paris";

    }

}

// Generates lhs_rs = db.exexuteSQL("SELECT * FROM CUSTOMER WHERE CITY = 
'Paris'")

Assert( SQL2DTranslator("lhs_rs = SELECT * FROM CUSTOMER WHERE CITY = 
Paris" ==  "lhs_rs = db.exexuteSQL("SELECT * FROM CUSTOMER WHERE CITY = 
'Paris'")"

well it is late, maybe I need some sleep...


More information about the Digitalmars-d mailing list