I noted while writing this answer that using an external Pattern on Format doesn't work:
p : Format[_foo] := bar
foo[1]
foo[1] (* did not work *)
The FormatValues reflect the definition:
FormatValues[foo]
{HoldPattern[p : _foo] :> bar}
However the definition is not in the correct form. Compare the one without Pattern:
ClearAll[foo]; Format[_foo] := bar; FormatValues[foo]
{HoldPattern[MakeBoxes[_foo, FormatType_]] :> Format[bar, FormatType], HoldPattern[_foo] :> bar}
Note that here the rule is rewritten in terms of MakeBoxes
foo[1]
bar (* it works now *)
Is this behavior a bug or is there a reason for Pattern to prevent the standard rule formation?
Format[_foo, _] := bargives the messageFormat::fttp: Format type _ is not a symbol. >>– Greg Hurst Jan 19 '15 at 20:18p :, so I wasn't sure if you had seen this message before. – Greg Hurst Jan 19 '15 at 20:23