13
$\begingroup$

Both Quiet and Internal`DeactivateMessages seem to suppress error messages. Does anyone have any experience with them and found any real differences?

$\endgroup$
  • $\begingroup$ I don't know what the difference are, but Quiet is invalid in parallel calculations. Maybe you can exam if the later one is invalid as well? $\endgroup$ – Turgon Sep 11 '16 at 4:34
16
$\begingroup$

Internal`DeactivateMessages[expr, msg1, msg2, ...] evaluates expr after turning off the given messages. When the second argument is not present (or All) then expr is evaluated in a special mode that does not generate any messages.

An example of a difference would be

Internal`DeactivateMessages[On[Power::infy]; 1/0, Power::infy]

(* gives a message *)

Quiet[On[Power::infy]; 1/0, Power::infy]

(* does not give a message *)

Internal`DeactivateMessages is the older and the simpler function. Quiet has been introduced in version 6.0 and is more sophisticated, as it also has the form

Quiet[expr, msgoff, msgon]

indicating that the messages in the list msgoff should not be generated, but those in msgon should be. Since there can be arbitrary nesting, Quiet acts similarly to a scoping construct, keeping track of the wanted/unwanted messages at each level.

I think the main reason Internal`DeactivateMessages still exists is backward compatibility. There should be no advantage in using it instead of the documented Quiet.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.