Why Message is not always traced?

喜你入骨 提交于 2019-12-11 10:19:47

问题


I am still puzzled by the fact that Message is not always traced when switching On[Message] while surely this function is called through the evaluator.

Consider:

In[1]:= On[Message,Plus];
1+1
Sin[1,1]
During evaluation of In[1]:= Plus::trace: 1+1 --> 2. >>
Out[2]= 2
During evaluation of In[1]:= Sin::argx: Sin called with 2 arguments; 1 argument is expected. >>
During evaluation of In[1]:= Message::trace: Message[Sin::argx,Sin,2] --> Null. >>
Out[3]= Sin[1,1]

In[4]:= Unprotect[Message];
Message:=Print[List[##]]&
1+1
During evaluation of In[4]:= {Plus::trace,1+1,2}
Out[6]= 2

It is obvious that Message is called in both cases through the evaluator because the call can be intercepted on the top level. But it is not traced in the case of 1+1. Why?

来源:https://stackoverflow.com/questions/5803432/why-message-is-not-always-traced

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!