I've been listening to the Harry Potter audiobooks, as one does.
There is a plot point in Harry Potter and the Deathly Hallows where Harry is counting down the days until he turns 17 when he is no longer under surveillance for use of under-age magic. It's a spell the magical community places on young magicians to maintain law and order, and perhaps a bit of Orwellian control.
There is a moment where Ron wishes Harry "happy birthday" early in the morning, and it immediately clicks to Harry that he can now use magic without detection! (They are currently on the run from Death Eaters so this is important).
Harry immediately casts a spell in celebration.
Me, the software developer, not being able to help myself, gets nervous. I literally think to myself "What if the curse is time zone sensitive, what if it's based on UTC, what if Harry was born later in the day and he hasn't actually hit 17 yet? What about leap years? Why doesn't Harry leave himself a buffer of certainty before casting a needless spell!"
And then I think to myself "that's not how magic works at all, that's how computers work." Technology and magic are not too different a lot of the time, but this is a significant distinction: Magic works as intended. Technology works as built.
In general, if Harry is 17, for all intents and purposes, the spell will be lifted. That's just how the universe works. When a spell doesn't work as intended, it's likely because the castor isn't capable of expressing their intentions effectively. This is why focus and nuance are such an important thing when casting. But when a wise witch or wizard casts a spell, it's going to work to their intentions.
Code just works how it works, we have off-by-one errors, we have time zones, we have string interpolation, we race conditions. Code does what it was built to do, but it's not magic, it doesn't just work as intended. No amount of wisdom makes code work as intended unless it is meticulously crafted to work this way. The closer it is to work as intended without the burden of edge cases, the closer it is to magic, but our code will never have the kind of guarantees of effectiveness that magic does. That's the deal.
Happy coding π§ββοΈπ§ββοΈ


Latest comments (27)
Sounds like the bug just became a feature. I'll close the bug.
We want DWIM (Do What I Mean.) We're stuck with DIY (Do It Yourself) and DWYS (Did Wut Yu Sed)
This is the tale of someone who's had to deal with timezones one too many times.. I feel you, you're not alone! ;)
β‘

One of my perennial favorite cartoons is My Little Pony: Friendship is Magic, and I always find it humorous how much unicorn magic in that show does behave like computer code.
A spell must be written down in at least one place before it can be cast, although if this "source" exists, it can be cast from memory. (Episode 65, 116/117, 167)
Destroying the last copy of the "source" means the spell can no longer be cast. (Episode 116/117)
Running a spell without verifying what it will do can have unexpected results. (Episode 65)
Unicorn magic is exactly as literal as computer code, and can have unintended results; outcomes have nothing to do with the intentions, only with the technique. (Episode 29, 55, 138, 145)
An object (relic) can contain specific magical properties or spells, but those magical properties can only be used in specific ways. You can't make a relic do something it was never intended to do. This is not unlike "compiled code". (Episode 118/119, 194/195, 209)
Unicorn magic "just works", although it must be powered either individually by a unicorn, stored energy in a relic, or another energy source. It's not impossible for non-unicorns to use unicorn magic, but that magic will behave the same no matter who is using it.
Charles Stross got some books out of this idea; I recommend them highly.
Cara, faz total sentido!
cheers :D
π»
It is like doing Math vs English.
Haha loved this!