PositronicVariables 1.5.1

dotnet add package PositronicVariables --version 1.5.1
                    
NuGet\Install-Package PositronicVariables -Version 1.5.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PositronicVariables" Version="1.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PositronicVariables" Version="1.5.1" />
                    
Directory.Packages.props
<PackageReference Include="PositronicVariables" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PositronicVariables --version 1.5.1
                    
#r "nuget: PositronicVariables, 1.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PositronicVariables@1.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PositronicVariables&version=1.5.1
                    
Install as a Cake Addin
#tool nuget:?package=PositronicVariables&version=1.5.1
                    
Install as a Cake Tool

PositronicVariable (.NET Library)

A time looping variable container for quantum misfits and deterministic dreamers. NuGet

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 ConvergenceCoordinator owns 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, so await won�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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.1 410 12/9/2025
1.5.0 655 12/2/2025
1.4.0 174 10/21/2025
1.3.4 179 10/20/2025
1.3.3 135 10/17/2025
1.3.2 131 10/17/2025
1.3.1 166 10/16/2025
1.3.0 127 10/10/2025
1.2.1 172 4/12/2025
1.2.0 174 4/11/2025
1.0.0 154 4/4/2025