Give warnings when using options not supported by a Builtin #645
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if options are given for commands that are not supported, they are simply ignored. This can be very confusing for novice users, especially if they mistype an option (e.g.
FieldSeperetors
instead ofFieldSeparators
).This PR adds a new meta option called
$OptionSyntax
that may be eitherStrict
,Warn
orIgnore
, and defines what should happen, if the user specifies an option that does not show up in theBuiltin
'soptions
dictionary.The default (also used if no
$OptionSyntax
is specified) is to give a warning but continue with evaluation.Strict
gives a warning and stops the evaluation (this happens forPlot
).Ignore
is the old behavior.In addition to this, this PR adds custom checks for
Import
andExport
that gives warnings for options that are not supported by the import/export plugin.In this current form,
Import
,Export
and other commands will warn about unused options, which might differ from MMA. Still, I think these kinds of warnings are so useful that we should accept their general existence in Mathics. In addition, some commands, likePlot
, really want to abort evaluation, if non-supported options are given, and this PR offers a solution for not having to code this checks for each single Builtin that wants to behave in that way.