identof || toIdent - feature suggestion / question

Kirk McDonald kirklin.mcdonald at gmail.com
Sat Jul 1 10:46:58 PDT 2006


Tom S wrote:
> Would it be hard to add a construct to D that would convert a 
> compile-time string to an identifier ?
[...]
> 
> Comments ? Suggestions ?
> 
> 

I can think of at least two distinct uses for that and the reverse 
operation in Pyd:

* Abstracting out the main "init" function so that it no longer requires 
a specific name (e.g. "inittestdll") and C linkage. Boost.Python does 
this with the preprocessor tricks outlined in Tom S's post.

* Removing the requirement for users to enter the names of functions and 
classes as strings, in addition to the actual symbols. I know DDL has 
templates that can get this string from the mangle of the class or 
template, but a built-in language feature is to be preferred.

So, my vote is for it, even if it is dreadfully dangerous. I'd be very 
interested in what Walter thinks of it.

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://dsource.org/projects/pyd/wiki



More information about the Digitalmars-d mailing list