According to some books, diffraction occurs when there is an obstacle whose linear dimensions are comparable to the wavelength of light. This is true also for a hole or a slit through which the light passes. My question is the following: shall we consider all the linear dimensions of an obstacle (height, width, thickness) compared to the light wavelength? Assuming there is a light beam which passes from a slit comparable with the light wavelength, shall we consider each linear dimension of the slit itself compared to the light wavelength?
The light is in principle going to be present in a three-dimensional region. In whichever directions the light is restricted, in those same directions it will subsequently spread out, and we call this diffraction. Usually we think of spreading out sideways (the transverse direction) for a beam of light. If we have a pinhole then the light spreads out in two dimensions. If we have a slit then the light only spreads out in the direction restricted by the narrow opening of the slit.
One can also restrict a beam of light in the longitudinal direction by chopping it very rapidly, turning it into a pulse. A short enough pulse will then start to spread out along its direction of travel.
Actually, diffraction occurs whenever there is a spatial or temporal alteration of the shape of a wave field. However it is easier to observe if it is caused by something with small features or by something that changes very rapidly.
Note that the edge of a large hole or of a razor blade is a very narrow feature, nearly infinitesimally narrow. Light passing an edge is diffracted.