4

Mathematica by default defines a lot of useful messages for signaling common errors, like functions being called with the wrong number of arguments or files not being found. In general, I prefer to use existing, defined messages wherever possible, because it makes it easier for them to be handled via mechanisms like Check, Quiet and On/Off. However, all my attempts at finding what messages are currently defined have failed; obvious approaches like

DownValues[MessageName] 

don't work at all.

Is there a trick I'm missing?

Thanks in advance.

4

1 回答 1

5

这是个好问题。原则上,您可以使用 显示与符号关联的任何消息Messages[<symbol>]。但是,根据文档,系统消息在实际使用消息之前不会加载。但是,$MessageGroups(7 中的新功能)确实提供了一些可用消息的列表,但不是几乎全部。

编辑:经过一番查看,我发现该文件$InstallationDirectory/SystemFiles/Kernel/TextResources/English/Messages.m似乎包含所有系统范围的消息。

于 2009-11-05T16:56:30.137 回答