From a stack trace for a crash:
20:12:01 INFO - 2 libxul.so!bool js::DependentAddPtr<js::HashSet<js::ReadBarriered<js::UnownedBaseShape*>, js::StackBaseShape, js::SystemAllocPolicy> >::add<JS::RootedGeneric<js::StackBaseShape*>, js::UnownedBaseShape*>(js::ExclusiveContext const*, js::HashSet<js::ReadBarriered<js::UnownedBaseShape*>, js::StackBaseShape, js::SystemAllocPolicy>&, JS::RootedGeneric<js::StackBaseShape*> const&, js::UnownedBaseShape* const&) [HashTable.h:3ba384952a02 : 372 + 0x4]
If you can figure out where in that mess the actual method name is without staring at this for at least 15 seconds, I salute you. (Note that when I saw this originally, it wasn’t line-wrapped, making it even less readable.)
I’m not sure how this could be presented better, given the depth and breadth of template use in the class, in the template parameters to that class, in the method, and in the method arguments here.
1. Hide all template arguments set to their default values. Although that doesn’t actually help in this case, since the HashSet is using non-default values.
2. Use template substitutions where they repeat.
This would give you js::DependentAddPtr::add(const js::ExclusiveContext*, T&, const KeyInput &, const ValueInput &) where:
T=js::HashSet<js::ReadBarriered, js::StackBaseShape, js::SystemAllocPolicy>
KeyInput=JS::RootedGeneric
ValueInput=js::UnownedBaseShape*
Not great, but marginally better.
Another idea would be to either omit the template arguments for the method or the method parameters.
Comment by Joshua Cranmer — 03.12.14 @ 14:08
Color.
Comment by Jason — 03.12.14 @ 16:26
jcranmer: in the context of stack traces that are sort of machine-generated, and sort of meant for human consumption, it’s possibly less good to omit defaults (1) or have substitutions (2). More human-readable, but also more hassle for mechanical consumers. Bleh.
Also for stack traces, omitting template arguments in a way that loses information also seems unideal. :-\
Comment by Jeff — 03.12.14 @ 16:55
jorendorff: good idea, if sending to a terminal. I’m looking at a try-log, so I only have pure text here. But maybe Unicode will add colored letters (color combining modifiers?) to permit this eventually! O brave new Unicode world, that has such possibilities in’t!
Comment by Jeff — 03.12.14 @ 16:57
Some whitespace might help, if it survives the blog software:
Comment by Neil Rashbrook — 04.12.14 @ 02:52