I’m creating a standard library for a programming language, and I’d like to license each and every single class or function in there under the MIT license, so they’re completely FOSS.
All of the files reside in a single directory. Would it be enough to put a LICENSE.txt file in the same directory, containing the MIT license? Do I need to say that the following license applies to all features of the library, or is the library itself considered to be a program?
The general practice is to place the license text in a clearly identifiable location, like you suggest, and to include comments near the top of each source file that tell the reader to look there. And don’t forget to make the license obvious to someone who doesn’t download the source code, just a binary.
As to what comprises a “program”, you get to ignore that. In a binary distribution, there’s no question – you download one .dll/.so/whatever file and a license file. In a source distribution, the license or a reference to it is present in every file.
2
Well, at one level the answer depends on the law of the legal jurisdiction you release your software in. So you might want to check that.
But more generally, adding a full copy of the text of the licence in the root directory of your distribution and then placing a one line comment in each source file is likely to convey your intentions very clearly.