You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening this issue to open discussion on what would be the best path for the log macro.
I preemptively made the change to allow the macro to accept expressions for single argument usages in #366 because I believe it is not breaking and only allows additional usage, but I didn't consider if it was intentionally similar to what is used for std::format.
The difference is that the current functionality, just like the format! macro, does not allow for expressions for single argument usages.
The alternative, which might be more familiar to anyone who has used the log crate, is allowing expressions to be provided as a single argument, which gives any user a cleaner experience.
Without the change, a simple example such as:
let s:String = "test".to_string();log!(s);
Requires that the string is required to be moved because you cannot take a reference manually or through a function with the :tt syntax.
With the change, which is just changing the arg type to expr, allows the following:
let s:String = "test".to_string();log!(&s);log!(s.as_str());println!("I can still use {}", s);
I think this can be done as a non-breaking change and can open it up in a separate PR from #366, which is for sure a breaking change, but let me know what you guys think!
The text was updated successfully, but these errors were encountered:
Opening this issue to open discussion on what would be the best path for the
log
macro.I preemptively made the change to allow the macro to accept expressions for single argument usages in #366 because I believe it is not breaking and only allows additional usage, but I didn't consider if it was intentionally similar to what is used for std::format.
The difference is that the current functionality, just like the
format!
macro, does not allow for expressions for single argument usages.The alternative, which might be more familiar to anyone who has used the
log
crate, is allowing expressions to be provided as a single argument, which gives any user a cleaner experience.Without the change, a simple example such as:
Requires that the string is required to be moved because you cannot take a reference manually or through a function with the
:tt
syntax.With the change, which is just changing the arg type to
expr
, allows the following:I think this can be done as a non-breaking change and can open it up in a separate PR from #366, which is for sure a breaking change, but let me know what you guys think!
The text was updated successfully, but these errors were encountered: