You might also be curious why the productsList variable is initialized as new list of strings at the start of the method, only for it to be overwritten by the code in the try block. This is a defensive mechanism that ensures that the productsList variable is always set to a meaningful value should the code in the try block fail for some reason. You will see an example of how such a failure might occur in Chapter 3.

2 Answers 2


To expand on Dusty's answer:

A more tentative version of

 if the code fails


 if the code should fail

In formal speech an writing, certain auxiliaries (principally 'had', 'were', and 'should', but occasionally 'could' and 'would' and rarely a few others) in an irrealis context can be inverted with the subject to get the same effect as the 'if':

 should the code fail
 had he but known
 were he to leave now

"Irrealis" means that the event or state of affairs has either not yet occurred, or is known not to have occurred when it might have.

"If he knows" and "if he knew" are realis: they are about present and past fact, which are either true or false, even though the speaker may not know which. These cannot be turned round in this way.

"If he should know", is an uncertainty about the future; and "if he had known" expresses a possibility which is known not to have happened; these are irrealis, and can be inverted as above.

As Dusty says, the verb is subjunctive (though in fact 'were' is almost the only distinctive subjunctive verb form in modern English); but I've never heard it called "future subjunctive".

  • Thanks for your detailed explanation! And can you tell me what the sentence "he had but known" in the examples above meaning?
    – Liu
    Dec 10, 2010 at 3:35
  • It means "If he had known (but in fact he didn't)". The "but", like its more colloquial cousin "only" adds a rhetorical or emotional suggestion of "it would have been better if he had known" or "I wish he had known".
    – Colin Fine
    Dec 10, 2010 at 11:17

Should in this usage basically functions similarly to if or in case. You could rewrite the sentence in question as:

This is a defensive mechanism that ensures that the productsList variable is always set to a meaningful value if the code in the try block fails for some reason.

As far as how it functions as a part of speech, I believe it's the future subjunctive form of the auxiliary verb shall (i.e. should fail is the verb phrase)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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