Better debugging: This would allow custom debugging channels to implement messages such as: Function 'crab' failed to do A B C, because of 1 2 3
Use function names in a logic
fn thing() {
match functionName == "thing" {
true => println!("Called from function called 'thing'"),
_ => println!("This function is not called 'thing' it's called {:1:}", functionName)
}
}
NOTE: There are a ways in rustlang to get this result, but that makes the code look ugly as it requires mentioning the function name within the function.
When you say 'tools', do you mean some kind of macro that wraps them? If so, what macro is it?
Also, IIRC the discussion that @mbrubeck linked to stalled out over what to do about closures (and maybe anything else that is like an anonymous function; do futures count here too? Or the unstable call() method?). Maybe instead of just a plain func!(), we have func!(file!(), line!(), column!()) fallback option so that if the inner most function-like scope is anonymous we fall back to something involving file!, line! and column! instead. Not great, but since this is just for println!() debugging, probably not too horrible either.
Alternatively, once std::backtrace is stabilized, we could use that as an alternative in those cases where it's unclear what func!() should really print out by printing out the full backtrace. Again, not great, but maybe not too horrible either.