Find symbol in unknown module at compile time?

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 7 18:58:45 PST 2014


> if you want to allow external pragmas that allows poking 
> private module
> data... well, just make everything in that module public, you 
> just
> killed the whole protection thing. ;-)

This is what I mean, but I don't think it would 'kill' anything. 
It's not like I'm suggesting that cast(public) be added to the 
language. I'm suggesting a special case pragma or something that 
can be added to a module that is responsible for reflection, to 
allow that module to do it's job.

I don't think what I am suggesting is that radical. It's 
basically the same thing as casting away const. Also, I don't 
think the problem is the feature, so much as the programmers that 
would start adding '#pragma privileged' to all their files 
without a good reason.

> what i really want to say is that if you need to even know about
> private members from the outside of the module, something is 
> very-very
> wrong.

For a publicly released library, I would agree, but if you wanted 
to use runtime reflection to tweak some variables during the 
development process, this would save you the trouble of having to 
modify your interface to allow it.



More information about the Digitalmars-d mailing list