Stasis

From Esolang
Jump to: navigation, search

Stasis is a pre-Socratic language first produced in the 5th Century BCE, recently revived by User:Rottytooth

Philosophy

We can speak and think only of what exists. And what exists is uncreated and imperishable for it is whole and unchanging and complete. It was not or nor shall be different since it is now, all at once, one and continuous... - Parmenides
  • the universe is in constant balance
  • there is only one number, its value is zero
  • other numbers are illusory, refractions of zero

Language Overview

Stasis transpiles to C#, with all primitives replaced with Stasis structs. It could just as well be implemented in JS or really any other procedural syntax. Each time a value is assigned, all other variables are adjusted to keep a collective sum of zero, but maintaining the same ratios. Like Entropy, Stasis has no true ints or chars; behind the scenes, each of these types are represented by a float. In Stasis, an int is the closest whole-number for the current value.

char

Chars are a special case in Stasis. Like ints, each is rounded to the closest whole number, then returned as the corresponding Unicode character. However, since there are no negative values in Unicode, every character in the Unicode table is interpreted as its negadecimal equivalent, making half the characters negative.

Examples

Dealing with ints

void main()
{
	int a = 1;
	Console.WriteLine(a);
}

Output:

0

Since there is no other variable to balance a with, its value remains zero

void main()
{
	int a, b = 5;
	Console.WriteLine(a);
}

Output:

-2.5

Hello World

Printing the "Hello, World!" string straight would end up "averaging" all the characters around zero, giving us:

????§PX?§???Y

To print the string correctly requires adding a satellite number to balance the string.

void HelloWorld()
{
	string hw = "Hello, World!"; 
	int i = -606;
	Console.WriteLine(hw);
}

This comes close to working, but the l's end up incorrect (128 instead of 108), giving us "He??o, Wor?d!"

void HelloWorld()
{
	string hw = "Jgnnq.\"Yqtnf#"; 
	int i = -550;
	Console.WriteLine(hw);
}

Instead, we can use .NET's treatment of chars above Char.MaxValue (modding by Char.MaxValue):

void HelloWorld()
{
	string hw = "Jgnnq.\"Yqtnf#"; 
	int i = 15056557;
	Console.WriteLine(hw);
}