M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Symbol as Optional Argument

Open mahrud opened this issue 1 year ago • 2 comments

For optional arguments that take in boolean values, currently you must type:

func(blah, Minimize => true)

but it would be nice if you could just type

func(blah, Minimize)

It carries the same information, can't be confused with a variable because optional argument symbols are protected symbols, and just looks nicer.

Probably the procedure that handles function closures with options needs to be modified to replace a standalone symbol Minimize with an option Minimize => true.

mahrud avatar Dec 15 '23 01:12 mahrud

but what if the function requires a Symbol as a (non-optional) argument?

pzinn avatar Jan 06 '24 01:01 pzinn

Are there functions that need options and symbols? It would be easy to change it so they accept a list of symbols instead, or there could be an option for method to disable this behavior.

mahrud avatar Jan 06 '24 02:01 mahrud