how to determine of a module or any other symbol is visible?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Mon Jun 18 09:34:42 UTC 2018


On Monday, June 18, 2018 21:28:00 rikki cattermole via Digitalmars-d-learn 
wrote:
> On 18/06/2018 9:24 PM, Mr.Bingo wrote:
> > On Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote:
> >> On 18/06/2018 9:03 PM, Mr.Bingo wrote:
> >>> In the code I posted before about CRC, sometimes I get a visibility
> >>> error for some modules. I would like to be able to filter those out
> >>> using traits. Is there any way to determine if a module is
> >>> visible/reachable in the current scope?
> >>>
> >>> The modules that are causing the problems are imported from other
> >>> code that imports them privately. The iteration code still finds the
> >>> module and tries to access it but this then gives a visibility
> >>> error/warning.
> >>
> >> Quite often when working with CTFE&traits, the easiest thing to do, is
> >> to do a check to see if whatever you're doing compiles. Nice and
> >> simple!
> >
> > This doesn't work with depreciation warnings.
>
> There won't be a way to check for those (I think).
> Easier to not worry about them until it turns into errors.

IIRC, there __traits(isDeprecated, symbol) should work now, though it's a
recent addition.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list