TL;DR
A programming language that uses one-based indexing imposes the condition that zero (0) is not a valid index for the language's built-in array type (or, matrix type).
Programming languages generally do not restrict the range of integer arguments passed into functions and data structures. In other words, function calls and data structures are generally not required to follow the one-based indexing rule.
Many programming languages encourage the convention that functions and data structures should mimic the way arrays work whenever applicable, so as to save the programmer-user from having to determine what convention to use every single time.
Whenever it doesn't make sense for certain functions and data structures to mimic a built-in array's behavior, then don't.
It is, therefore, the responsibility for a programmer proficient in that language to figure out how to implement what needs to be done in a least burdensome way.
A programming language that uses one-based indexing will generally need to specify how to resolve these issues idiomatically.
Code sample in MATLAB:
% someVector is a MATLAB row vector
someVector = zeros(1, 6);
if true
% valid MATLAB code
someVector(1:6) = -1:-1:-6;
else
% invalid, matrix index cannot be zero
someVector(0) = 0.99;
end
%% ......
% someFunction is a MATLAB function
function result = someFunction(a)
if a == 0
result = 0.99;
else
result = -a;
end
end
% Zero is a valid value when used as a function argument
b = someFunction(0);
%% ......
% MATLAB has a dictionary type too.
cm = containers.Map('KeyType', 'int32', 'ValueType', 'any');
% Zero is a value in int32. It is valid to use zero as a key.
cm(0) = 0.99;
A prime example is the Fast Fourier Transform (an implementation of Discrete Fourier Transform), or more generally the representation of any signal processing code.
Each element of the array is supposed to represent the coefficient for Z0, Z1, Z2, and so on.
It is obvious that MATLAB's one-based indexing will cause tremendous trouble to the novice user, because the coefficient for Z0 cannot be stored in a vector at index 0. It can only be stored at index 1.
Yet, MATLAB users simply swallowed their complaints. A convention has evolved that every dependent (signal) variable should have a corresponding independent (domain) variable, and that nobody should assume that the values inside an independent variable starts at one.
In the following MATLAB code example, a vector (sequence) named k is created as the input to the mathematical function "z raised to power k". The output is saved in a vector (sequence) named 'y'.
Observe that, the elements in y and the elements in k are in correspondence. Instead of expecting that y(30) containing the value z30, a MATLAB user first finds the element in k that contain 30, then finds the corresponding element in y. A typical usage is thus
y30 = y(k == 30);
Such usage may look tedious, but it is largely hidden from the everyday user's view because they are taken care of inside library functions.
One could argue that this is computationally inefficient. The one-line code above entails a whole-array equality comparison in order to find the index of the element in k that equals 30, and then use the index to read the element from y. (If the array length is one million, and a programmer uses this one-line code a million times, the time complexity is proportional to one million squared.)
(Disclaimer: The following example is intended to illustrate the array indexing issue. It is not intended to illustrate signal processing concepts.)
% vector length
n = 128;
% a row vector of length 128, with content 0, 1, 2, ... 127
k = 0 : n-1;
% let's create some complex number
z = exp(0.005j);
% let's compute z raised to the power of something
y = z .^ k;