In the novel The Hobbit, towards the start of the story Bilbo wishes Gandalf a good morning:
"Good Morning!" said Bilbo, and he meant it. The sun was shining, and the grass was very green. But Gandalf looked at him from under long bushy eyebrows that stuck out further than the brim of his shady hat.
"What do you mean?" he said. "Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?"
"All of them at once," said Bilbo. "And a very fine morning for a pipe of tobacco out of doors, into the bargain.
Now I've always found that dialogue strange, but likely an author of Tolkien's calibre doesn't put passages in for no reason. What is the purpose of this? What are we supposed to learn about the characters? That Gandalf is a pedant?
I'd be interested to hear insights.