Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use symbols instead of strings for option names #604

Open
maxitg opened this issue Feb 3, 2021 · 0 comments
Open

Use symbols instead of strings for option names #604

maxitg opened this issue Feb 3, 2021 · 0 comments
Labels
breaking Introduces changes that could break existing code refactor Does not change functionality, but makes the code better organized or more readable wolfram language Requires Wolfram Language implementation

Comments

@maxitg
Copy link
Owner

maxitg commented Feb 3, 2021

The problem

We currently prefer using strings over symbols for options. This, however, is not consistent with conventions even for new System`* symbols in Wolfram Language. As a result, some of our options (ones identical to existing System` ones) use symbols and some use strings. Users are then required to remember which one is which.

Possible solution

I suggest to switch to using symbols for option names. This will require writing usage message for each of them and making sure they don't conflict with system symbols and other packages.

@maxitg maxitg added refactor Does not change functionality, but makes the code better organized or more readable breaking Introduces changes that could break existing code wolfram language Requires Wolfram Language implementation labels Feb 3, 2021
maxitg added a commit that referenced this issue Feb 7, 2021
…rmation and syntax autocompletion (#603)

## Changes

* In the Mathematica options inspector, there is an option called `"HighlightMissingArgumentsWithTemplate"`.
* If you turn it on, in case of missing arguments, instead of displaying a single red arrow, you will get a helpful hint with argument names which can serve as a super fast lightweight documentation (like you would get in, e.g., Xcode after autocompleting a function):

<img width="362.4" alt="HighlightMissingArgumentsWithTemplate" src="https://user-images.githubusercontent.com/1479325/106001860-133b6880-6076-11eb-8fd8-a8549dfe4ac6.png">

* The names of the arguments are taken from pattern names in `SyntaxInformation`.
* This PR adds names to all `SyntaxInformation` except for the built-in `RulePlot` thus enabling this feature for all *SetReplace* symbols.

* This also adds missing usage messages, syntax information, and syntax autocompletion.
* Expands argument names in usage messages to be descriptive so that using autocompleted templates are more informative.

## Comments

* `Null` is due to `OptionsPattern[]`. It can be changed to, say, `opts` if that pattern is named as `opts : OptionsPattern[]`. However, if one does that, some optional arguments will always be displayed in the template, which is, of course, unacceptable. I think we'll have to wait until this weed is fixed upstream:

<img width="324.0" alt="image" src="https://user-images.githubusercontent.com/1479325/106002768-200c8c00-6077-11eb-9d79-3a4e07caa2bc.png">

* Autocompletion is generally disabled for option names. The problem is that I'm not aware of a way to enable autocompletion for multiple arguments at a time. In order to solve this, we need to use symbols instead of strings for options (#604), and we need to figure out how to autocomplete the values for enum-like options (#605).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Introduces changes that could break existing code refactor Does not change functionality, but makes the code better organized or more readable wolfram language Requires Wolfram Language implementation
Projects
None yet
Development

No branches or pull requests

1 participant