Update site.
This commit is contained in:
@@ -1,33 +1,35 @@
|
||||
#+title: MagicNG
|
||||
#&summary
|
||||
The Next Generation Programming Language
|
||||
#&
|
||||
#+license: bysa
|
||||
#&toc
|
||||
---
|
||||
abstract: The Next Generation Programming Language
|
||||
---
|
||||
|
||||
* Chapter 1: The Future of Yesterday
|
||||
# MagicNG
|
||||
|
||||
/Software./
|
||||
*From 2012.*
|
||||
|
||||
/Magic./
|
||||
|
||||
# Chapter 1: The Future of Yesterday
|
||||
|
||||
*Software.*
|
||||
|
||||
*Magic.*
|
||||
|
||||
Two seemingly unrelated words. Yet together they form the essentials of the new
|
||||
programming language which has already changed how computers and humans interact
|
||||
with each other: *MagicNG* (short for Magic: The Next Generation).
|
||||
|
||||
*MagicNG* is not your common programming language; it is not biased towards one
|
||||
**MagicNG** is not your common programming language; it is not biased towards one
|
||||
or two paradigms, in fact it uses none of the existing ways of programming:
|
||||
|
||||
+ Functional programming is, naturally, much too functional for any magic-based
|
||||
programming language, as magic is not /functional/, but
|
||||
/magical/. Magic-based software does not require functionality as in something
|
||||
being able to do something else, because it depends on magic which /does/
|
||||
stuff instead of making sure that /stuff/ can be done; this makes using a
|
||||
programming language, as magic is not *functional*, but
|
||||
*magical*. Magic-based software does not require functionality as in something
|
||||
being able to do something else, because it depends on magic which *does*
|
||||
stuff instead of making sure that *stuff* can be done; this makes using a
|
||||
computer much faster.
|
||||
+ Object-oriented programming does not fit very well with the ideas behind
|
||||
*MagicNG* either. While the magic-oriented approach /is/ able to properly
|
||||
**MagicNG** either. While the magic-oriented approach *is* able to properly
|
||||
emulate object-oriented ways of doing things, such emulations will often
|
||||
require {CMU&abbr='Central Magical Unit'}-expensive conversions from spell
|
||||
require CMU-expensive ('Central Magical Unit') conversions from spell
|
||||
scrolls to object-based representations.
|
||||
+ Procedural programming conflicts with the nature of magic; since in the case
|
||||
of magic, advanced heuristics are used run a program, the simple approach of
|
||||
@@ -40,14 +42,14 @@ with each other: *MagicNG* (short for Magic: The Next Generation).
|
||||
programming languages do, however, still base their entire existence on
|
||||
deduction and knowledge, both of which are infinitely long below the
|
||||
standards of magical programming languages. Deduction and knowledge are for
|
||||
programming languages that do not /see/ how everything works, whose authors
|
||||
programming languages that do not *see* how everything works, whose authors
|
||||
do not understand the connectionabilities of everything.
|
||||
|
||||
In short, *MagicNG* employs the *magical programming* paradigm because it is
|
||||
In short, **MagicNG** employs the *magical programming* paradigm because it is
|
||||
superior to non-magical approaches.
|
||||
|
||||
|
||||
** But how do I program in it?
|
||||
## But how do I program in it?
|
||||
|
||||
The reader should now be comfortable thinking about programming in terms of
|
||||
magic and be able to see what a big mistake it was to learn all those outdated,
|
||||
@@ -60,12 +62,12 @@ applications of magical programming, to pique the reader's curiosity.
|
||||
|
||||
1. First, there is the temporal improvement. Since magic is independent of the
|
||||
flow of time, a program can be run not just everywhere, but
|
||||
every{/when/}. This is the sole reason MagicNG is already so popular ---
|
||||
every*when*. This is the sole reason MagicNG is already so popular ---
|
||||
someone spread its use many years ago, through several temporal-offset
|
||||
MagicNG runs.
|
||||
2. Speed. The Central Magical Unit runs programs magically many times faster
|
||||
than any CPU in existence. This is possible due both to the previously
|
||||
explained effects of magic in programming /and/ what we will come to refer
|
||||
explained effects of magic in programming *and* what we will come to refer
|
||||
as "magic downleveling" in later chapters (since magic cannot be optimized,
|
||||
other approaches such as the downleveling approach have been developed).
|
||||
3. Code maintenance also becomes much easier, as you will see in the examples
|
||||
@@ -74,16 +76,16 @@ applications of magical programming, to pique the reader's curiosity.
|
||||
Now, to our first example. We wish to print to a computer console (on a magical
|
||||
computer) the magical string "Hello, world!". This is often accomplished in
|
||||
anything from 1 to 100 conventional lines in conventional programming
|
||||
languages; in MagicNG, it is not /that/ simple. It's another kind of simple,
|
||||
namely the /magic simple/ way, from now on referred to as the /magple/ way.
|
||||
languages; in MagicNG, it is not *that* simple. It's another kind of simple,
|
||||
namely the *magic simple* way, from now on referred to as the *magple* way.
|
||||
|
||||
To write the magple MagicNG code for this example, we first fire up our MagicNG
|
||||
interactive interpreter:
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
MagicNG vX
|
||||
?
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
(MagicNG is not being developed because it relies on magic for updates, hence
|
||||
the 'X' version.)
|
||||
@@ -95,19 +97,19 @@ computer and then print afterwards.)
|
||||
The =?= at the prompt means we can type something. Let us try typing the
|
||||
following:
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
? one frog eye
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
What this tells the MagicNG interpreter is that if /it is not the case/ that no
|
||||
What this tells the MagicNG interpreter is that if *it is not the case* that no
|
||||
frog eyes exist in the programmer's vicinity, it will print "Hello,
|
||||
world!". The frog-eye detection is only a formality, included in MagicNG to
|
||||
make the proofs of magical truth be magically true, and so the sentence can be
|
||||
excluded if the programmer wishes so. That is, you could write
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
t
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
which is short for "one frog eye", and it would have the same effects.
|
||||
|
||||
@@ -126,13 +128,13 @@ Now, it may not be obvious to the casual non-magician why and how both "one
|
||||
frog eye" and "t" eventually prints "Hello, world!". In fact, these two
|
||||
expressions are not at all the only ways to print "Hello, world!" --- one can
|
||||
also write "traveller with seven legs", "spider queen", or something
|
||||
similar. The thing to remember is that it is /the intention/ that counts. If
|
||||
you /feel/ that the expression "bonsai of Norway" prints the sum of all
|
||||
prime numbers below 4012, then /that is what it does/.
|
||||
similar. The thing to remember is that it is *the intention* that counts. If
|
||||
you *feel* that the expression "bonsai of Norway" prints the sum of all
|
||||
prime numbers below 4012, then *that is what it does*.
|
||||
|
||||
In essence, MagicNG is an *intention-based programming language*. This might at
|
||||
first sound like all other programming languages: You have an intention on
|
||||
which you base your programming. The difference here is that the intention /is/
|
||||
which you base your programming. The difference here is that the intention *is*
|
||||
the programming and not just part of it. Once you have figured out what you
|
||||
want and written it down in your inner language, magic takes care of the boring
|
||||
stuff.
|
||||
@@ -153,10 +155,10 @@ is compiled along with your program. With MagicIS, a compiled program that
|
||||
prints "My name is Niels" might look like this (imagine it compiled on a
|
||||
scroll):
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
Holy oak of honey
|
||||
,si:pmnin34_=UUe
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
where the =,si:= part denotes the start of the serialized intention.
|
||||
|
||||
@@ -165,7 +167,7 @@ command-line option. Note that it will need to be connected to your brain with
|
||||
a special magical interface to work.
|
||||
|
||||
|
||||
* Chapter 2: Real World Examples
|
||||
# Chapter 2: Real World Examples
|
||||
|
||||
"This is all very nice," you might think, "but what is it any good for?"
|
||||
|
||||
@@ -173,51 +175,51 @@ MagicNG can be used for everything a typical, non-magical language can be used
|
||||
for, the major differences being that MagicNG is per definition faster, better
|
||||
and easier to program in. This has been magically proven.
|
||||
|
||||
** cat
|
||||
## cat
|
||||
|
||||
Consider the UNIX =cat= program. If written in C (even if you look at the Plan
|
||||
9 version), there are many lines of source code. If written in Python 3, there
|
||||
are 2 lines:
|
||||
|
||||
#+BEGIN_SRC python3
|
||||
```
|
||||
for line in open(filename):
|
||||
print(line)
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
If written in MagicNG, there is _one_ line (/and/ it is magical):
|
||||
If written in MagicNG, there is _one_ line (*and* it is magical):
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
cauldron of candy
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
(without MagicIS enabled.)
|
||||
|
||||
|
||||
** Finding a value when a key is known
|
||||
## Finding a value when a key is known
|
||||
|
||||
In a non-magical programming language, you could use a hash map. Or you could
|
||||
sort the elements by their keys and use binary search. Or you could look
|
||||
through every element one by one.
|
||||
|
||||
In MagicNG, no such algorithms are used; /magic/ finds the value. In fact, this
|
||||
In MagicNG, no such algorithms are used; *magic* finds the value. In fact, this
|
||||
reveals a large, fascinating and unavoidable part of MagicNG: it does not
|
||||
support algorithms.
|
||||
|
||||
"No algorithms? But how, then, can I program?" you think. The answer is simple,
|
||||
and it has been explained before, but to stress it one last time: /magic/.
|
||||
and it has been explained before, but to stress it one last time: *magic*.
|
||||
|
||||
This leads us to another important part of MagicNG: its use of the *black box
|
||||
model*. The /black box model/ has been revered all over the known universe for
|
||||
model*. The *black box model* has been revered all over the known universe for
|
||||
its unchangeability (it is absolute), unworsenability (since you cannot change
|
||||
it, you cannot make it worse), high surprise factor ("who knew my program could
|
||||
do /that/?!"), and lack of meaningful error messages (no errors, no worries).
|
||||
do *that*?!"), and lack of meaningful error messages (no errors, no worries).
|
||||
|
||||
|
||||
** Calculating the sum of a list of numbers
|
||||
## Calculating the sum of a list of numbers
|
||||
|
||||
In C:
|
||||
|
||||
#+BEGIN_SRC c
|
||||
```
|
||||
int sum(int xs[], int xs_len) {
|
||||
int fin_sum = 0;
|
||||
int i;
|
||||
@@ -230,22 +232,22 @@ int sum(int xs[], int xs_len) {
|
||||
[...]
|
||||
|
||||
sum({1, 3, -2, 9}, 4);
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
In Python:
|
||||
|
||||
#+BEGIN_SRC python3
|
||||
```
|
||||
sum([1, 3, -2, 9])
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
In MagicNG:
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
head of Macbeth
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
|
||||
** A flight simulator
|
||||
## A flight simulator
|
||||
|
||||
Up until now, we have only looked at MagicNG programs spanning single
|
||||
lines. One can create a very powerful MagicNG program in one line, but
|
||||
@@ -255,26 +257,26 @@ As a flight operator, you may wish to have a very durable and efficient 3D
|
||||
flight simulator; in MagicNG such a system can be written concisely in just
|
||||
three lines of magical code (four lines with MagicIS enabled).
|
||||
|
||||
#+BEGIN_SRC text
|
||||
```
|
||||
dragon claw polished with golden mead
|
||||
mead in cauldron
|
||||
tastebuds of 23 pigs
|
||||
,si:3=)uUUn!2aa
|
||||
#+END_SRC
|
||||
```
|
||||
|
||||
(Notice the indentation and the explicit number.)
|
||||
|
||||
|
||||
/[Chapters 3 through 88 have been excluded in this preview. Only members of
|
||||
the Magically Magical Magic Community (MMMC) have access to these chapters.]/
|
||||
*[Chapters 3 through 88 have been excluded in this preview. Only members of
|
||||
the Magically Magical Magic Community (MMMC) have access to these chapters.]*
|
||||
|
||||
|
||||
* Chapter 89: How to Learn More
|
||||
# Chapter 89: How to Learn More
|
||||
|
||||
To recap: MagicNG is an easy language to learn, since not only does it not
|
||||
require the user to learn about algorithms, data structures and related wastes
|
||||
of time, but actually discourages that; MagicNG encourages its users to /not
|
||||
think/ which /reduces errors/.
|
||||
of time, but actually discourages that; MagicNG encourages its users to *not
|
||||
think* which *reduces errors*.
|
||||
|
||||
To expand your knowledge of MagicNG, both in theory and practice, do not look
|
||||
at the examples of other MagicNG programmers, unless you are *absolutely sure*
|
||||
@@ -287,4 +289,3 @@ actually a very complex language).
|
||||
What you should do is lean back in a comfy chair and look into nothingness and
|
||||
not strain your mind. That way, everything you need to know will come to you
|
||||
eventually. That's how this book was written.
|
||||
|
||||
Reference in New Issue
Block a user