It seems, to me, useful for temporary testing... But the maintenance nightmare would be evident the first time an editor, unaware of the macro, posted on here that there was a bug in the PB ReadData command. Oops. Narrow that down to it's minimum code example!
Allow redefinition of PureBasic functions within modules
Re: Allow redefinition of PureBasic functions within modules
Re: Allow redefinition of PureBasic functions within modules
It's fine as long as you don't UseModule with a module that has such a macro. I don't recommend this keyword except for very small blocks of code where it can improve readability. This isn't an issue with modules but rather a side effect of macros in general. There's nothing to stop you from redefining all of PureBasic internal functions at your leisure.
This is actually a GOOD thing and allows macros to be used in this way to fix bugs with immediate results. But I agree that overriding internal functions globally can be dangerous when caught unaware. That is why being able to redefine internal functions within a module is safer than what would be possible otherwise.
But this request isn't about overriding internal functions for that purpose. This feature request is pointing out the problem of scope within modules. The fact that we have to use macros to do this at all is the point. We just shouldn't have to.
The workaround is cool. But it's also super gross to use in practice and makes unreadable code.
Code: Select all
Macro MessageRequester(a, b, c=0)
Debug "I do nothing!"
EndMacro
MessageRequester("","")
But this request isn't about overriding internal functions for that purpose. This feature request is pointing out the problem of scope within modules. The fact that we have to use macros to do this at all is the point. We just shouldn't have to.
The workaround is cool. But it's also super gross to use in practice and makes unreadable code.