PositronicVariables 1.5.1
dotnet add package PositronicVariables --version 1.5.1
NuGet\Install-Package PositronicVariables -Version 1.5.1
<PackageReference Include="PositronicVariables" Version="1.5.1" />
<PackageVersion Include="PositronicVariables" Version="1.5.1" />
<PackageReference Include="PositronicVariables" />
paket add PositronicVariables --version 1.5.1
#r "nuget: PositronicVariables, 1.5.1"
#:package PositronicVariables@1.5.1
#addin nuget:?package=PositronicVariables&version=1.5.1
#tool nuget:?package=PositronicVariables&version=1.5.1
PositronicVariable (.NET Library)
A time looping variable container for quantum misfits and deterministic dreamers.
PositronicVariable<T> simulates values that evolve across iterative timelines. Think Schr�dinger's variable: simultaneously filled with regret and potential. Now with automatic convergence, STM-backed transactional updates, telemetry, and existential debugging.
Not exactly time travel but close enough to confuse your boss.
Features
- Temporal journaling: remembers past states better than you remember birthdays
- Automatic convergence: simulates logic until values settle (therapy not included)
- NeuralNodule: quantum flavoured neurons for group therapy style computation
- Time reversal: runs logic backward, forward and sideways (flux capacitor optional)
- Seamless integration with
QuBit<T>from QuantumSuperposition - STM telemetry: commits, retries, aborts, validation failures, lock-hold timings, contention hotspots
- Read-only fast path: validate-only transactions with no lock acquisition
Getting Started
Installation
dotnet add package PositronicVariables
Quick Example
Logical loop with no stable resolution:
[DontPanic]
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.State = val;
}
Output (after convergence)
The antival is any(-1, 1)
The value is any(1, -1)
Two state paradox. Like a light switch held halfway by indecision. Convergence matters. Without it you loop until the compiler cries.
Transactions and Telemetry
Use the ambient transaction scope for multi-variable atomic updates. Read-only transactions validate without taking locks.
using PositronicVariables.Transactions;
// Read-only fast path
a = PositronicVariable<int>.GetOrCreate("a", 1);
using (var tx = TransactionScope.Begin())
{
TransactionScope.RecordRead(a);
}
// Update with retry and telemetry
TransactionV2.RunWithRetry(tx =>
{
tx.RecordRead(a);
var next = a.GetCurrentQBit();
tx.StageWrite(a, next + 1); // stage a new qubit state
});
Console.WriteLine(STMTelemetry.GetReport());
Feynman Diagram Style View
Time ->
[initial guess] - val = -1 * antival -> antival = val -> [back in time]
^_______________________________________________|
We created a cycle. The engine iterates until the values stabilise. If they never settle you get superpositions. Emotional baggage for integers.
Thread-safety Notes
- Ordinary updates: feel free to mutate from multiple threads via
TransactionV2/TransactionScope. Reads-only take the fast lane (no locks), writes stage and commit atomically with per-variable locks. - Convergence and friends: the convergence loop, reverse/forward replay, the Timeline Archivist, and the QuantumLedgerOfRegret all behave like a very polite single passenger queue. A
ConvergenceCoordinatorowns this queue and the exclusive engine token. - Mutation gates: timelines only change in two blessed places: (a) during transactional apply at commit for variables in the write set, or (b) on the coordinator while it clutches the engine token. Public API exposes
IReadOnlyList<QuBit<T>>; bring your own transactions if you want changes. - Ledger etiquette: ledger entries are buffered inside transactions and appended exactly once after commit. Direct poking of the global stack is discouraged and internally serialised for everyone�s safety and tea time.
- Debug nags: in Debug builds we complain loudly if the convergence engine is entered while transactions are active, or if something tries to mutate a timeline outside the approved gateways. This is for your own good (and ours).
- Async sanity: ambient transaction context and operator logging suppression use
AsyncLocal, soawaitwon�t quietly wander off with your invariants.
Useful For
- Chaotic yet stable feedback loops
- Declarative state systems
- Probabilistic neural style networks
- Philosophical debugging sessions
- Impressing precisely 2.5 people at parties
Limitations
- Convergence engine is not intended for multi-threaded mutation while the loop is running.
- Types must implement
IComparable.
License
Unlicensed. Use it. Break it. Ship it. Regret it.
Questions or Paradoxes?
File an issue or collapse reality and start again.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.13.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.4)
- Microsoft.Extensions.Hosting (>= 9.0.4)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.4)
- QuantumSuperposition (>= 1.7.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.