In my current case, I need a reliable way to check if a class can be allocated or not. How can one do this if the method is remains present even when it can not be used?
=end
"allocator" in the error message does not mean #allocate method, but internal C function (thus TypeError not NoMethodError).
We haven't provide the way to check if a class can be allocated, except for actually allocating an object.
I don't think we need to prepare the way to check explicitly.
So you think rescuing the error is good enough. Ok, I'll handle it that way. Would it be prudent to make the error very specific, e.g. UndefinedAllocatorError. So that rescue clauses can be sure to catch that specifically?
I am not positive about adding exception classes. So far, TypeError only caused by inexistence of allocator.
Assessments like "So far", are what make's a coder worry. In future that could change, then my code suddenly has potential error in it. However, I realize this is very unlikely, so I won't fret over it. But unlikely or no, I'd rather have zero probability of worry!