flamer icon indicating copy to clipboard operation
flamer copied to clipboard

Infer better names

Open JustAPerson opened this issue 8 years ago • 3 comments

I was first curious if it was possible to easily modify things to use the full paths of items (module::fn_name instead of fn_name), but asking on #rust-internals, that may be impossible. So I guess perhaps an alternate scheme would be to allow an argument to the attribute, specifying a name.

#[flame("module::fn_name")]
fn fn_name() {}

I think that would be a really useful feature (especially if it wasn't applied recursively), perhaps deserving a different attribute.

JustAPerson avatar Mar 05 '17 00:03 JustAPerson

I've been pondering with the same issue a week ago. While an automated approach would obviously be the preferred way, I'd consider an optional label a worthy workaround.

I am however not sure if it really is impossible. At a quick glance I'd argue that my apply_attr does something similar. Rules are applied recursively, carrying along all kinds of meta-information. Why shouldn't we be able to carry along the current parent path?

regexident avatar Mar 05 '17 10:03 regexident

I was trying to use flamer with project that uses specs and annotated all systems run methods with flame, but because all of the methods have the same name the resulting data is basically useless.

So I cannot use flamer without this something like this.

WaDelma avatar Feb 25 '18 14:02 WaDelma

I think we should be able to do this, at the expense of requiring a global #![flamer] annotation. Then we'd just keep a stack of modules, etc. and prepend that (joined by"::") to each name.

llogiq avatar Feb 25 '18 17:02 llogiq