-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Custom polymorphic logging #2366
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
Comments
I think we should not have smarter polymorphic logging but rather a Types could make use of this if we embedded a back pointer to the tck in the type box. |
FWIW there is already a to_str iface in core::to_str. On a slightly related note I consider that it might be nice if the + operator on strings called .to_str() on its arguments, like in Java/Javascript, because it makes code like |
Not quite done yet: making |
This may get fixed by the new logging system in #3309 which is already nominated for a maturity milestone. I do think whatever we end up with should support to_str(), so nominating this for production ready. |
Just a note: in the compiler itself, for now, I suggest writing |
accepted for backwards-compatible milestone |
@catamorphism, would you consider this closed with the new formatting traits of |
I think we consider this fixed now, although we still need to migrate away from the old formatting. |
The example I have in mind is:
where
t: ty::t
. It would be great if I could write:and not have to write out the call to
ty_to_str
. perhaps there could be an RTS hook to say "for typety::t
, callty_to_str
? I guess this could potentially be very hard since at runtime, tys probably aren't distinguished from ints. Alternately, (though not quite as awesomely), there could be another format string specifier or something for types. Basically, I just want to be able to pretty-print a type in a#fmt
call without writing outty_to_str
, because that's a lot of characters :-) (And slightly more seriously, then I have to importty_to_str
, which requires remembering what module it lives in...)The text was updated successfully, but these errors were encountered: