__FUNC__ in D

Regan Heath regan at netmail.co.nz
Wed Aug 15 15:10:43 PDT 2007


BCS wrote:
> Regan Heath wrote:
>> On 2nd thought I think this only works by some sheer coincidence and 
>> fluke!
> 
> The whole idea is a hack. Hacks are only /suposed/ to work when the user 
> does things exactly right

True.  There are many combinations which will break it, i.e.

const(char)
baz()

will get a function called "const", an extra check of p[start..end] 
using isKeyword would fix a few of these sorts of problems.

>> A better one could definately be written with the DMDFE.
> 
> yes but do you want to port DMDFE to run using CTFE?

Actually I think I have some code to lex C/C++ here somewhere and with 
very few changes it would lex D just as well.  That would be easier that 
using a full blown DMDFE port.  I might see what I can whip up tomorrow 
(it's 11pm here).

Regan


More information about the Digitalmars-d-learn mailing list