HolyC

The language the whole system is written in.

One compiler is the shell, the scripting language and the application language. Pick an example.

Take the tour

"Hello, world!\n";

No main, no printf

A string on its own is a statement that prints. Top-level statements run as you type them, so the command line and the language are the same thing.

U0 Count(I64 n=3)
{
  I64 i;
  for (i=0;i<n;i++)
    "Line %d\n",i;
}
Count;
Count(5);

Default arguments, no parentheses

A call with no arguments needs no parentheses. Default values make short calls the norm.

class Pt
{
  I64 x,y;
};
Pt p;
p.x=3; p.y=4;
"%d\n",p.x*p.x+p.y*p.y;

Plain structs with methods of thought

A class is a struct. There is no inheritance machinery to learn before you can read the code.

U8  a=255;   // unsigned 8 bit
I64 b=-1;    // signed 64 bit
F64 c=2.5;   // 64 bit float
U0  Nothing; // void

Sizes in the name

U8, I16, U32, I64, F64 and U0 say what they are. I64 is the default integer.

// a sketch of the Demo style
CDC *dc=DCAlias;
dc->color=RED;
GrCircle(dc,100,100,40);
DCDel(dc);

The screen is a few calls away

Graphics is a library call, not a toolkit. Kosmos builds its windows, fonts and dock on this layer.

Snippets are short sketches of the style, not tested programs. The graphics one assumes the Demo-folder conventions.

Why HolyC is worth learning.

What stands out when you come from C or C++.

The shell is the language

Type an expression and get the answer, or write a whole program on the prompt. There is no separate scripting layer and no built-in calculator, because the compiler is the shell.

Compiled as you type

Code is compiled just in time, so there is no main function. A statement at the top of a file simply runs.

No linker, no object files

Include a file and it is compiled and loaded straight into the live namespace. One walkthrough reports compiling about 50,000 lines in under a second.

Everything is indexed

Names complete everywhere, including symbols, and you can jump to any definition from anywhere, the shell included.

Output you can click

Files, directories, documents and disassembly are hyperlinks. Disassemble a function, then click a symbol to land in its source.

Reflection built in

Every class member can be enumerated with its name and offset, and given extra metadata such as defaults, ranges and format strings. C++ developers have wanted this for decades.

Draw with a loop

Animation is a loop that writes pixels. No window class, no message pump and no invalidate call.

Starts at once

No virtual memory to set up, no drivers to probe and no service manager. The walkthrough reports about half a second to boot, from an ISO of about 16 MB.

One unified thing

The shell, the editor, the documentation and the file browser share one hyperlink system, instead of four tools that barely talk to each other.

The trade-off: everything runs at the highest privilege level, so there is no safety net. A bad pointer or an uncaught exception takes the whole system down. That is why we run it in a VM and add protection around it; see Security and HC+.
Source: a C++ developer's walkthrough of TempleOS. We have not independently checked every figure in it.

Sixteen colours, and that is all of them.

TempleOS draws in the classic VGA palette. The desktop gets its greys and its softness from dithering and smoothing, not from more colours.

Click a colour. Its HolyC name is copied.

Boot it and look around.

Build the image, run it in QEMU, and the desktop is there in a few seconds.