A pairing that you're willing to give up on using for any other purpose
Angle brackets have a strong history in this role, but <
and >
are also common comparison operators. Square brackets are used in a number of languages, but often overlap with an indexing operator. So are parentheses, which often have overlapping uses for function application or precedence. Braces don't come up a lot for this use, but are heavily used elsewhere for scoping and collection literals.
These overlapping uses create parsing difficulties, particularly for partially-complete code that needs syntax highlighting. At what point do you know whether x < y * z
is a type expression or not? Is list[string] *z
declaring a pointer to a list of strings or multiplying a value? The language implementation itself probably knows, or knows what error to throw, but other systems need to parse the code as well, as do people.
Not every language has all of those complications - perhaps all comparisons are done with methods, indexing uses parentheses, application uses juxtaposition, etc. If there's a "keyboard pair" that isn't in use elsewhere, use that one, and if there's more than one, pick your favourite.
What if they're all gone?
If you do need to use angle brackets, parentheses, square brackets, and braces all for other purposes, doubling up is a good option. list[[string]]
is a little more typing, but if [[
never appears anywhere else in code then you've immediately got a clearer understanding of what's going on with only a local view. Find a pair that can't ever show up in normal code and use that.
Alternatively, shift one of the other uses to a double if that is less common. If indexing is expected to be rare but types are ubiquitous, maybe it doesn't need to squat on prime real estate.