Based on this question (Can the sleep spell wake me up?) I had a question about the mechanics of the sleep spell. I don't currently play D&D, so I'm not too familiar with the rules. However, I read the text of the spell here. It is a ranged enchantment with a duration of one minute. Since the spell has a duration rather than occurring instantaneously, I was wondering what happens if a creature moves into the range while it is active, or if a creature that was previously ignored by the spell (such as an unconscious creature) becomes eligible for the effects before the end of the spell.
My guess was that it would affect the creature normally (assuming the spell hasn't already put to sleep enough creatures to reach the HP limit) but when I asked about it in the comments I encountered some different opinions. What is the best way to interpret this spell? Are there any general principles that I'm unaware of?
Thinking about it, I guess the other way of interpreting it would be to say that "Creatures within 20 feet of a point you choose within range are affected" has an implicit time constraint that they have to be in range at the moment the point is chosen. So it seems like the mechanics of ranged spells are important here.
This just made me think of another related question, which I think is close enough to also ask here: what happens if a creature that was in range at the start, and put to sleep, is moved out of range before the end of the spell?