I recently came across this quote from Daryl Gregory on the difference between fantasy and science fiction:

Readers will read something as science fiction if the characters are engaged in the process of science. In fantasy there’s no fiddling with the rules. You pull a sword out of a stone, and that makes you King of England. There’s no, ‘But what if I put a sword into the stone?’ In a science fiction novel, everybody would be trying to figure out how to make more kings by inserting more sharp objects into rocks! A fantasy novel is almost distinguished by not asking those fundamental questions about what is going on. A science fiction novel, no matter what the rules, is always asking those questions.

Part of me likes this, but part of me disagrees completely — Brandon Sanderson’s fantasy novels, for example, ask those questions and have their characters engaged in what fundamentally is science, albeit focused on magic. And yet the books are clearly fantasy.