[suggestion] importing and renaming by wildcard and/or regexp

Hipreme msnmancini at hotmail.com
Wed Jul 27 10:02:24 UTC 2022


On Thursday, 21 July 2022 at 22:08:14 UTC, AnimusPEXUS wrote:
> Why?: for example I have module bindbc.glfw - It have symbols 
> like GLFW_KEY_* so I want to import only GLFW_KEY symbols.
>
> additionally: "Renamed and Selective Imports" with renaming by 
> using regexp groups, so for example if I want to import 
> GLFW_KEY_(\w+) and rename those like so MY_KEY_$1


Soo this is a bit too much, it would complicate a lot development 
and it could open a lot of  opportunities for nasty bugs, 
ideally, those key definitions should be in their own module.

About the massive renaming, if you ever used std.regex you would 
know how slow it is to build that, but much beyond that, this is 
an overcomplication that should be totally avoided, glfw uses C 
enum declarations, while you could just create a named enum and 
if you ever wanted, you could just alias it


More information about the Digitalmars-d mailing list