-
-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings for macro-in-macro. #7348
Comments
Are all of the problems here due to macros containing macros in the same file? I'm wondering if we could just detect that somehow and give a more specific error for that. |
We have an option to show macro-in-macro by using |
If we add a warning for this we also need a way to avoid the warning in case you genuinely want to have a macro-in-macro call. |
Ok, more drastic then: How about forbidding it to see if anybody complains? Since macro-in-macro busts the cache, I doubt anybody would "genuinely want to have a macro-in-macro call" other than for some funky experiments. It creates way more problems than it solves. |
I'm experimenting with this, but our mutual friend haxelib gets in the way because of this: class Main {
static var VERSION:SemVer = SemVer.ofString(getHaxelibVersion());
static var VERSION_LONG:String = getHaxelibVersionLong();
macro static function getHaxelibVersion() {
var haxelibJson:Infos = Json.parse(File.getContent("haxelib.json"));
return macro $v{haxelibJson.version};
}
macro static function getHaxelibVersionLong() {
var version:String = VERSION; |
How about |
That won't be enough because there's some legit macro-in-macro handling going because |
Without further ado I present to you: |
That still won't do because.... you know what, how about you just fix it? :P |
I'll do my best, but I have no way of knowing if it's fixed, do I? :P |
Although the way it's implemented right now is not ideal. It warns when typing a macro-in-macro, which is not necessary. We only care about it if we actually call such a macro. |
I meant |
Until macro-in-macro is properly supported, we should warn when it's used (personally I wouldn't mind an error). It would go a long way to make things easier for newcomers. I've lost count of how many times I saw some variant of this problem: https://community.haxe.org/t/injecting-a-local-variable-with-macro/953
The text was updated successfully, but these errors were encountered: