Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a rationale, beyond historical accident, why some Mathematica option values are strings, while others are symbols?

It seems natural that some value spaces, e.g. named color schemes, are so numerous and only applicable to ColorData, e.g. ColorData["HTML"] and so should be strings.

On the other hand wouldn't it make more sense if "XAxis" in PairedHistogram[..., BarOrigin -> "XAxis"] were a built in symbol to be shared as an option value across composite graphics functions?

share|improve this question
1  
Related question –  Leonid Shifrin Mar 27 '13 at 21:33
    
Thanks for the link. –  alancalvitti Mar 27 '13 at 21:35
1  
Btw, strings almost always work even when the option is a symbol –  Rojo Aug 3 at 3:05

1 Answer 1

up vote 10 down vote accepted

In older versions (5 and before), most option names were symbols. It's since about version 6 that string option names have proliferated.

I think that the reason is to avoid cluttering the name space. Once you introduce a new name, it won't be available for package authors to use for other purposes (in particular, function names). At least not without shadowing the built-in one. Considering the huge number of options introduced since version 6, I think it was a good decision to use strings for most of them.

Every time a new symbol is introduced in a new version, there's a chance it will break some third party package. Using strings reduces the likelihood of this happening. Strings, unlike symbols, are not part of a namespace (so there's no shadowing issue) and can't ave associated definitions (so breakage due to conflict is impossible).

share|improve this answer
3  
+1. I agree with your reasoning, I also think it is namespace-related. This does however come at a price - string options are much less discoverable in the documentation and otherwise. –  Leonid Shifrin Mar 27 '13 at 21:41
2  
@Leonid Yes, that is the disadvantage. Auto-completion doesn't work. Theoretically this could be remedied by improving auto-completion in the front end ... –  Szabolcs Mar 27 '13 at 21:41
    
Szabolcs' answer makes sense. But also thanks for pointing out documentation - which is often a struggle. One would think keyword registration and search to be entirely feasible. –  alancalvitti Mar 27 '13 at 21:43
    
Talking about documentation and options, I still couldn't figure out how to use the "EdgeLayout" suboption of GraphLayout ... see here –  Szabolcs Mar 27 '13 at 21:44
    
I also get Graph[<<4>>,<<3>>] with EdgeLayout in MMA9. Have you filed a note w/ tech support? –  alancalvitti Mar 27 '13 at 22:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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