What we often refer to as Snell's law:
$$n_1 \sin(\theta_1) - n_2 \sin(\theta_2) = 0$$
has quite a bit of history behind it. It can be demonstrated in several ways, one of which is by asserting that along the boundary there is no discontinuity in phase from one side to the other, or if there is, that it's constant.
What I usually call "the grating equation"
$$n_1 \sin(\theta_1) - n_2 \sin(\theta_2) = \frac{m \lambda}{d}$$
where $m$ is the integer order and $\lambda$ and $d$ are the wavelength and periodic grating spacing can be demonstrated by asserting that at a periodic array of points spaced $d$ apart there is no discontinuity in phase, but what happens between those points is now unconstrained. That's how multiple non-zero orders are now possible.
Question: Proper, periodic diffraction gratings are much more recent items than glass lenses. Where does the grating equations come from? Who first wrote it, did it it precede actual diffraction grating experiments, and does it have another name?