Find symbol in unknown module at compile time?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 7 19:10:43 PST 2014


On Mon, 08 Dec 2014 02:58:45 +0000
bitwise via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> > 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 believe that if you need to access some private module thingys, that
thingys are made private erroneously.

> I don't think what I am suggesting is that radical. It's 
> basically the same thing as casting away const.
i'm still sure that compiler should forbid such casts. there should be
no way to remove 'const' after it's sticked.

> 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.
but they will. ;-) you know, "just in case" or "to speedup the things".

btw, i think that default module protection must be "private", not
"public". having module imports as private by default but everything
else as public is confusing.

> > 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.
if you need to tweak something private... well, it's not private
anymore, there must be public API to do that. that API can be version'd
out later (or documented).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141208/3c4a8eed/attachment.sig>


More information about the Digitalmars-d mailing list