digitalmars.D.learn - how to determine of a module or any other symbol is visible?
- Mr.Bingo (8/8) Jun 18 2018 In the code I posted before about CRC, sometimes I get a
- rikki cattermole (3/11) Jun 18 2018 Quite often when working with CTFE&traits, the easiest thing to do, is
- Mr.Bingo (2/15) Jun 18 2018 This doesn't work with depreciation warnings.
- rikki cattermole (3/19) Jun 18 2018 There won't be a way to check for those (I think).
- Jonathan M Davis (5/25) Jun 18 2018 IIRC, there __traits(isDeprecated, symbol) should work now, though it's ...
- Cauterite (13/19) Jun 18 2018 you can try the -de flag:
- Jonathan M Davis (8/28) Jun 18 2018 Turning things into errors affects type introspection - e.g. the result ...
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.
Jun 18 2018
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!
Jun 18 2018
On Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote:On 18/06/2018 9:03 PM, Mr.Bingo wrote:This doesn't work with depreciation warnings.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!
Jun 18 2018
On 18/06/2018 9:24 PM, Mr.Bingo wrote:On Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote:There won't be a way to check for those (I think). Easier to not worry about them until it turns into errors.On 18/06/2018 9:03 PM, Mr.Bingo wrote:This doesn't work with depreciation warnings.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!
Jun 18 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:IIRC, there __traits(isDeprecated, symbol) should work now, though it's a recent addition. - Jonathan M DavisOn Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote:There won't be a way to check for those (I think). Easier to not worry about them until it turns into errors.On 18/06/2018 9:03 PM, Mr.Bingo wrote:This doesn't work with depreciation warnings.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!
Jun 18 2018
On Monday, 18 June 2018 at 09:28:00 UTC, rikki cattermole wrote:On 18/06/2018 9:24 PM, Mr.Bingo wrote:you can try the -de flag: // foo.d: deprecated void foo() {} pragma(msg, __traits(compiles, foo())); --- dmd foo.d -> true dmd -de foo.d -> false --- couldn't think of any examples of deprecated visibility to try thoughOn Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote: 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.
Jun 18 2018
On Monday, June 18, 2018 11:53:50 Cauterite via Digitalmars-d-learn wrote:On Monday, 18 June 2018 at 09:28:00 UTC, rikki cattermole wrote:Turning things into errors affects type introspection - e.g. the result on __traits(comiles, ...) - so it's usually a bad idea. It's bad enough that -w is a compiler flag without adding -de into the mix. That just makes it easy to end up with code that doesn't compile or takes an unintended branch of a static if, because a symbol was recently deprecated, and the code hasn't been updated yet. - Jonathan M DavisOn 18/06/2018 9:24 PM, Mr.Bingo wrote:you can try the -de flag: // foo.d: deprecated void foo() {} pragma(msg, __traits(compiles, foo())); --- dmd foo.d -> true dmd -de foo.d -> false --- couldn't think of any examples of deprecated visibility to try thoughOn Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote: 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.
Jun 18 2018