Magic is Programming

B2 Chapter 25: A New Language



Amber yawned, but shook her head and determinedly held on to wakefulness. She straightened her back and rubbed a little sand out of her eyes, then turned to face Carlos, who was sitting crosslegged next to her in their tent. She reached out to him mentally, through their shared bond with Purple. [Alright, we've both finished building your "integrated development environment" idea. Now show me what's so amazing about it.]

Carlos shook off a yawn of his own and looked back at her. [Are you sure you want to do this tonight? We're both very tired.]

[I've waited long enough already. I admit we don't have the energy to really get into it in depth right now, but I want to at least get my first glimpse of it.]

[Okay. Give me a minute.] Carlos concentrated on something for a long moment. Just when Amber was starting to worry that he might have fallen asleep, he finally stirred again. [There. It's borrowing rather heavily from the languages I'm most familiar with, not adjusted much for the use cases of incantations, and I'm sure it's incomplete and will need a lot of refinement, but it's done. I made a preliminary version of my new spell design language and copied it to Purple's knowledge store. See if you can get your spell language database to accept it.]

Amber reached for Purple's knowledge repository and examined the new… thing in it. [Uh. Just looking at that, I really can't make much sense of it. It feels like… I guess a tangled knot of… memories? Experiences? Wordless concepts? It's all pretty tightly woven, and I can't pick out any single thing in it clearly.]

Carlos sent a feeling of sheepish embarrassment over the link. [Yeah, sorry. I kind of just… shoved my intuitive understanding of what I want into a language definition and massaged it until it worked. It's the only way to do it quickly enough for tonight. I'd prefer to put everything in explicit words, examining and considering every detail, but that would take a lot more time. Nowhere near as long as it would take to make an incantation version of the IDE, but still too long.]

Amber cocked her head and blinked. [Wait, you think you could make an incantation to duplicate what we devoted 13 soul structures to?]

[Not easily, not quickly, and only 12 of them at most. As far as I know, the spell database must be a soul structure. But the editor, transpiler, optimizer, and all the rest? Given unlimited time to work on it? Yes. It would take me multiple decades, or even a century, but I could eventually do it. Earth's software engineers did it for computers without soul structures, and incantations have the necessary capabilities for it to be possible.]

Amber sat in stunned silence, contemplating the idea of a spell that would help design and create whatever other spells you wanted. After perhaps a minute, she tentatively ventured a question. [And whoever did it didn't keep it to themselves?]

Carlos laughed loudly, a single time, then cut himself off. [Sorry, sorry, it's an entirely reasonable question in light of your background. It's just that Earth's situation is so very different that the idea of not selling it on Earth seems ridiculous. The personal benefits of such a thing are much smaller than here. In this world, we might be able to use it to develop our personal power to unprecedented heights, and anyone selfish would never even consider sharing such a powerful advantage for any ordinary price. On Earth, the only way for the creators of an IDE to gain significant personal benefit from it is to sell it - and not just to one person, or a few, but to as many buyers as they can possibly find. Millions of people, for the most popular ones. Oh, and there are several different ones, all made by teams of people working together.]

He shook his head and let out a long, slow breath. [But enough of that side track. That bundle isn't meant to be understood directly; it's meant to be put into your spell language database, and from there to be used by all the other structures. So, see if you can get your database to accept a copy of it as a spell language definition.]

[Alright.] Amber mentally touched the weird tangled knot of knowledge and willed the copying to happen. Her own language database rejected it at first, as it didn't exactly fit what she'd originally had in mind as how a spell language should be defined, but she altered the database to make it accept this form of a definition. The alteration took some time to find the right solution and settle, but then information began to flow. Concepts, rules, and connections flew past her mind faster than she could even glimpse most of them. Just seconds later, it was done. [Okay, now what?]

Carlos grinned at her. [I say always start out learning a new language with the basics. So, let's go back to the very first spell we ever learned: Light. Use your detranspiler to convert the… 12 lines of that incantation into this language, and see what it's like.]

Amber could feel anticipation practically radiating from Carlos as he watched. She smiled uncertainly, then brought the Light spell to mind. [Alright, let's see what I get.] She focused on her spell editor and commanded it to invoke the detranspiler and show her the result. A section of text appeared in her mind's eye, and she almost did a double take at it. [Did something go wrong? It's so small!]

spell { do { glow(color: white, shape: sphere, direction: all, intensity: 0.01, location: target); } while (true); }();

[Wait…] Amber read through the contents of it, identifying the parts that corresponded to each part of the original incantation. [Never mind, it's all there. Just a lot shorter.]

Carlos's delight bubbled over as he nodded with a beaming smile. [Actually, let me make a small tweak to the language… There, get that update and try again.]

[Alright.] Amber touched Purple's knowledge store again, and found it only took a moment to take in just the difference for the new version.

spell { continuous { glow(color: white, shape: sphere, direction: all, intensity: 0.01, location: target); } }();

[Huh. Okay, that does make it a little easier to understand. But why are the effects indented, and why did you make this language require indenting like that? And how the hell are people supposed to speak indentation? Timed pauses of just the right length before each line?]

A case of literary theft: this tale is not rightfully on Amazon; if you see it, report the violation.

Carlos answered with the firmest conviction Amber had ever seen him show. [Because the first and most important trait of good code is that it must be readable - easy for others to understand - and proper indentation like that makes the structural context of sections of code instantly obvious at a glance, when it would otherwise require considerable extra reading and analysis to figure out. As for speaking, this language is not meant to be spoken. It doesn't need to be spoken, because it won't be used in actually casting anything.]

Amber blinked and gave Carlos a long look. [Why do you feel so strongly about that?]

Carlos let out a dry, humorless laugh. [Try teaching two dozen novices who don't understand why readability matters, let them use a language that doesn't enforce proper indentation, and give them work to do something non-trivial. When you see the unreadable abominations some of them come up with, you'll understand.] He shuddered. [But for something more immediate, how about we take a look at how the Find Path spell Trinlen showed us looks in this language.]

Amber nodded. [That will double as a test that the detranspiler can work with just the words of an incantation, too, since we haven't actually learned that spell yet.]

spell { Location destination = displaceLocation(location: target, east: 2134.2, south:: 788.6, down: 46.9); Distance distance = distance(firstLocation: target, secondLocation: destination); Integer detourLimit = 1000; label restart: Location current = target; List path = makeList(); path.append(current); Integer length = 1; List reached = makeList(); reached.append(current); do { foreach (Location neighbor in listNeighbors(location: current, distance: 0.5, directions: cardinals, orderCriterion: proximity, proximalLocation: destination)) { Distance firstDistance = distance(firstLocation: neighbor, secondLocation: target); Distance secondDistance = distance(firstLocation: neighbor, secondLocation: destination); if (firstDistance + secondDistance - distance > detourLimit) goto nextNeighbor; foreach (Location reachedLocation in reached) { if (neighbor == reachedLocation) goto nextNeighbor; } Line connection = lineSegment(firstLocation: current, secondLocation: neighbor, width: 0.5); if (scanDensity(region: connection) > 120) goto nextNeighbor; if (scanCohesionStrength(region: connection) > 80) goto nextNeighbor; if (distanceOfSupportSurface(location: neighbor, direction: down, weight: 300) > 5) goto nextNeighbor; path.append(neighbor); reached.append(neighbor); current = neighbor; length += 1; goto continue; label nextNeighbor: } path.removeLastElement(); current = path.getLastElement(); length -= 1; if (length != 0) goto continue; detourLimit *= 2; goto restart; label continue: } while (current notNear destination); … }

Amber didn't bother even skimming the parts of the spell that took the found path, which was often something atrocious, and found ways to improve it to be more reasonable. [What was it that you called the later parts of this spell, again? A "rotten pile of" something about kludges and monkeys?]

Carlos chuckled. [I believe I called it "a rotting pile of every kludge but the kitchen sink, taped together at random by monkeys until they found a combination that, for reasons no one could possibly comprehend, somehow works." Anyway, what do you think of the initial part? It's still far from what I would consider actually good, but compared to the original incantation language?]

[Oh, is that why the linter and optimizer are almost yelling at me?] Amber yawned again, then shook her head. [It's definitely shorter.] She tried to read through it in more detail, but even with the text all being presented directly to her mind by a soul structure, it all seemed blurry. She tried to focus one more time, but soon gave up and let her fatigue pull her head down onto Carlos's shoulder beside her. [Too tired. I'll think about it tomorrow.]

[That's fair. What we told Ressara about not pushing herself too hard really should go for us too.]

Amber was only dimly aware of Carlos gently lowering her head onto pillow, and fell asleep soon after.

The next morning, both of them woke up late and felt much better rested. Crown Mage Felton was openly waiting for them when they came out of their tent. He had a complete suit of the sabotaged armor set up on an armor stand in a nearby clear spot outside the collection of tents, and he was standing beside it, tapping his foot impatiently. He even scowled a little when Carlos and Amber went to eat a quick breakfast first, but did not protest.

Carlos called Trinlen to join them and took the lead, walking confidently up to the suit of armor and focusing on it even as he spoke to the royal mage. "Alright, Felton, how do you want to start this collaboration?"

Felton gave a nod of acknowledgement. "Lord Carlos. Lady Amber. I take it you want your employee to share in any lessons I give."

Carlos nodded. "That would be appreciated, but my main reason to include him is that his unusual creativity might help solve the sabotage mystery."

Felton gave Trinlen a hard look, but soon shrugged and addressed Carlos again. "Very well. You have made your version of Ressara's defense against attention diversion, correct? We can begin with seeing what you can determine with that and your mana sense, as things stand now. I expect little or no immediate results, but it will serve as a starting point to assess your capabilities and what shortcomings I might need to teach you to rectify."

"That sounds reasonable. Let me see…" Carlos inspected the armor's enchantments carefully while slowly walking a circle around it. Amber stood in place and just leaned a bit closer while doing her examination. Examined from outside without using its self-reporting features, the whole thing was still inscrutably complex and too dense for him to make out any truly meaningful details, but the texture it formed in his senses was finer-grained than it used to be. Something else new stuck out much more strongly to him, however.

"Okay, I can tell you that the attention diversion wards in this thing apparently react to any attempt to examine the enchantments, regardless of how much or how little details the senses they're reacting to can detect. And they are really, really tiny. I felt a lot of tugs on my attention, trying to push me away from noticing one thing and instead notice something else that was so nearby that I couldn't otherwise even sense that the two things were separate."

Felton nodded gravely. "That makes sense for the subtlety and sophistication of the known effect of it. It also strengthens my suspicion that it was built in by the armor's original creator. Lady Amber?"

Amber looked up briefly from her continued probing of the enchantments. "I felt the same effect. We'll need to refine our mana sense to get any useful details."

Felton waved a hand dismissively. "That will certainly help, but it is a matter of soul structures and long practice, not something I can teach. I gather that it is part of your plans for tomorrow, when you reach Level 19 and your Tier 8 merge." He paused for a moment, and Carlos and Amber both nodded. "Good, but that will be of limited benefit without knowledge of runic enchantments to go with it."

His mana poked something specific in the armor's gauntlets, and each gauntlet's armored plates started peeling back. Felton paused for a moment. "Oh, but before I begin the lessons, I should ask: in what ways do your house secrets change the best way to teach you?"

Enhance your reading experience by removing ads for as low as $1!

Remove Ads From $1

Tip: You can use left, right, A and D keyboard keys to browse between chapters.