Well, it's not supposed to. There was a time when you couldn't print
much of anything without hosing yourself. Now, AFAIK, you can quite
safely print symbols; printing trees may or may not be safe, not sure;
printing types is not safe, haven't looked into why.
Why can you print symbols?
scala> intp("scala.collection.parallel.mutable.ParMap").info.members
map (_.defString) >
def withDefaultValue: <?>
def withDefault: <?>
...
Because it is discriminating about it. Give the infos a little nudge,
see some more.
scala> intp("scala.collection.parallel.mutable.ParMap").info.members
foreach (_.info)
scala> intp("scala.collection.parallel.mutable.ParMap").info.members
map (_.defString) >
def withDefaultValue(d: <?>): scala.collection.parallel.mutable.ParMap[K,V]
def withDefault(d: <?>): scala.collection.parallel.mutable.ParMap[K,V]
All manifestations of the typer being invoked (or really, much of
anything being invoked) when calling toString should in my view be
considered bugs. If necessary there could be a flag somewhere which
is flipped into forcing mode when printing errors or wherever else it
is that one actually wants to influence the outcome by printing
something. But the default should be to affect nothing.
Oops, I gotta go. Let me quote SI-5045:
"When using a regular expression a user can state explicitly that they
want anchoring and the Regex library should not mandate that decision.
As an aside this often leads to people surrounding their patterns with
".*PTRN.*" which can turn a nice fast pattern into one with heavy
backtracking. See Mastering Regular Expressions by Friedl for
details."
And now let me quote the code:
/** The start of a scaladoc code block */
protected val CodeBlockStart =
new Regex("""(.*)((?:\{\{\{)|(?:\u000E<pre(?:
[^>]*)?>\u000E))(.*)""")
/** The end of a scaladoc code block */
protected val CodeBlockEnd =
new Regex("""(.*)((?:\}\}\})|(?:\u000E</pre>\u000E))(.*)""")
Short of adopting the suggestion made in the ticket, replacing .* with
.*? at the start might result in big gains.
--
Daniel C. Sobral
I travel to the future all the time.