A time-looping variable container for quantum misfits and deterministic dreamers.
$ dotnet add package PositronicVariablesA time-looping variable container for quantum misfits and deterministic dreamers.
PositronicVariable<T> lets your code simulate values that evolve over iterative timelines. Think of it as Schrödinger’s variable: simultaneously filled with regret and potential. Now enhanced with automatic convergence, timeline journaling, and existential debugging capabilities.
Not exactly time travel, but close enough to confuse your boss.
QuBit<T> from QuantumSuperposition.Available from NuGet (already available in futures you've yet to experience).
dotnet add package PositronicVariables
What happens if you create a logical loop with no stable resolution?
internal static class Program
{
[PositronicEntry]
private static void Main()
{
var antival = PositronicVariable<int>.GetOrCreate("antival", -1);
Console.WriteLine($"The antival is {antival}");
var val = -1 * antival;
Console.WriteLine($"The value is {val}");
antival.Assign(val);
}
}
The antival is any(-1, 1)
The value is any(1, -1)
You're trapped in a two-state paradox. Like a light switch held halfway by Schrödinger’s indecision. This is why convergence matters — without it, you're just running in timeline circles until the compiler cries.
Let’s visualize what just happened:
Time →
[initial guess] — val = -1 * antival —→ antival = val —→ [back in time]
↑_______________________________________________________|
We created a cycle. PositronicVariables evaluate by iterating this loop until the values settle. If they never settle? You get superpositions. Like emotional baggage, but for integers.
[PositronicEntry]
static void Main()
{
double a = 2.0;
var guess = PositronicVariable<double>.GetOrCreate("guess", 1.5);
// Watch the convergence happen before your eyes
Console.WriteLine($"sqrt({a}) ≈ {guess.ToValues().Last()}");
double v = guess.ToValues().Last();
guess.Assign((v + a / v) / 2.0);
}sqrt(2) ≈ 1.414213562
Yes, this is real. No, we didn’t skip a step. The past just updated itself when we committed to the present.
.ToValues().Last()?You're not just creating a variable.
You’re summoning a cloud of possibilities — all the potential values that guess could take as the program recursively rewinds and replays itself. Like a looping dream sequence where it tries different outcomes until it finds one that satisfies the logic across all iterations. The final value is the one that successfully stabilized the timeline.
This example discovers prime numbers not by checking every number, but by defining a single candidate variable that evolves forward through convergent timeline rewriting:
[PositronicEntry]
internal static class Program
{
private static void Main()
{
var candidate = PositronicVariable<int>.GetOrCreate("candidate", 2);
var primes = new List<int>();
for (int i = 2; i < 100; i++)
{
int number = candidate.ToValues().Last();
if (IsPrime(number, primes))
{
primes.Add(number);
Console.WriteLine(number);
}
candidate.Assign(number + 1);
}
}
private static bool IsPrime(int n, List<int> primes)
{
if (n < 2) return false;
foreach (var p in primes)
if (n % p == 0) return false;
return true;
}
}candidate.ToValues().Last() gives you the current most accurate prediction of the prime.candidate.Assign(number + 1) defines how that candidate moves forward through time.This is a state machine without explicit states — just a variable inching forward through causally consistent branches until the timeline locks in the truth.
2
3
5
7
11
13
...
97
Now you can quantum-entangle your strings too:
internal static class Program
{
[PositronicEntry]
private static void Main()
{
var greeting = PositronicVariableRef<string>.GetOrCreate("greeting", "Hello");
Console.WriteLine($"Current greeting: {greeting}");
var nextGreeting = greeting.ToValues().First() switch
{
"Hello" => "Hi",
"Hi" => "Hey",
"Hey" => "Hello",
_ => "Hello"
};
greeting.Assign(nextGreeting);
}
}Current greeting: any("Hello", "Hi", "Hey")
And yes, it’s probably too much power for your coworkers. You're welcome.
When you mark your entry method with [PositronicEntry], the library automatically:
Variables pretending to be regular numbers:
var v = PositronicVariable<int>.GetOrCreate("v", 1);
var x = v + 5;
var y = x % 3;It’s all syntactic sugar over quantum indecision.
var x = PositronicVariable<int>.GetOrCreate("x", 0);
var y = PositronicVariable<int>.GetOrCreate("y", 1);
var node = new NeuralNodule<int>(inputs =>
{
var sum = inputs.Sum();
return new QuBit<int>(new[] { sum % 5, (sum + 1) % 5 });
});
node.Inputs.Add(x);
node.Inputs.Add(y);
node.Fire();
Console.WriteLine($"Result: {node.Output}");Run an entire network until consensus:
NeuralNodule<int>.ConvergeNetwork(nodeA, nodeB, nodeC);IComparable (sorry, incomparables).Unlicensed. Use it, break it, ship it, regret it.
File an issue or collapse reality and start again.