MarymoorStudios.Core.Generators 1.0.0.10-preview

Prefix Reserved
This is a prerelease version of MarymoorStudios.Core.Generators.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MarymoorStudios.Core.Generators --version 1.0.0.10-preview                
NuGet\Install-Package MarymoorStudios.Core.Generators -Version 1.0.0.10-preview                
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="MarymoorStudios.Core.Generators" Version="1.0.0.10-preview">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MarymoorStudios.Core.Generators --version 1.0.0.10-preview                
#r "nuget: MarymoorStudios.Core.Generators, 1.0.0.10-preview"                
#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.
// Install MarymoorStudios.Core.Generators as a Cake Addin
#addin nuget:?package=MarymoorStudios.Core.Generators&version=1.0.0.10-preview&prerelease

// Install MarymoorStudios.Core.Generators as a Cake Tool
#tool nuget:?package=MarymoorStudios.Core.Generators&version=1.0.0.10-preview&prerelease                

Logo Marymoor Studios Core Libraries

The Marymoor Studios Core Libraries are a set of tools for developing concurrent and distributed applications.

Contact and Pricing

Explore license purchase options at the Marymoor Studios Online Store. Or, contact Marymoor Studios, LLC at info@marymoorstudios.com to inquire about additional license pricing and purchase options. Both free non-commercial use licenses, and paid commercial licenses are available.

The Core Libraries

The Core Libraries are a suite of C# tools offering a unique, easy to use, correct-by-construction, approach to race-free concurrent programming. Inspired by Midori, E-lang and Erlang, the Core is a Promise-based, single-threaded software-isolated process (Sip) model loosely conforming to Tony Hoarse's Communicating Sequential Processes (CSP) formalism.

Data Contracts:

  • Formal structured data contracts.
  • Support for all C# primitives (including byte arrays, DateTime, and unsigned values).
  • User Defined Types (UDTs) via attributed class, struct, record, or record struct types.
  • Support for inheritance, collections, and enumerables.
  • Support for polymorphic serialization and deserialization.
  • Support for generic types.
  • Cross-versioning support through partial materialization.
  • Custom Serialization extensibility points (for 3rd party types).
  [DataContract]
  public abstract record GameEvent();

  [DataContract]
  public sealed record BuildCreate(PlayerToken Token, Vector2I Target) : GameEvent;

  [DataContract]
  public sealed record BuildDestroy(PlayerToken Token, Vector2I Target) : GameEvent;

Promise-based Computational Model:

  • Promise/Promise<T> as a drop-in replacement for Task/Task<T>.
    • Full support for async and await keywords.
  • Single-threaded continuation scheduling:
    • Naturally Lock-Free: Eliminates the need for locks or mutexes.
    • Great for Game Development (e.g. Unity or Godot) because continuation scheduling happens directly on the event-loop thread between frames. No races and can directly interact with game engine objects.
    • Race-Free Parallelism: Create multiple Sips to leverage multi-core parallism.
      • Both concurrent and parallel workloads are supported.
      • Always race-free with efficient, structured, cross-Sip, message-passing based communication.
  • Sequence<T> provides efficient bulk transfer, subscriptions, and transformations.
    • IAsyncObservable-style event-driven programming with server-push support.
    • Fully integrated into the RPC system as a first class data type.
  • Resolver<T> supports ad-hoc as well as structured concurrency.
      int count = 0;
      // Add-hoc resolution with first-class resolvers.
      Resolver<Void> r1 = new();

      // Promise-based computations and composition.
      Promise p1 = new(r1);
      Promise p2 = p1.When(() => count++);
      // Promise chaining.
      p2 = p2.When(() => count++);

      // Explicit resolution.
      r1.Resolve();

      // Await for resolutions to settle.
      await p1;
      // Downstream propagation through the computational graph.
      await p2;

      // Functional data-flow
      Promise<int> p3 = p1.When(() => Promise.From(count));
      Assert.AreEqual(2, await p3);

Formal Eventual Interface Specifications:

  • Remotable stateful objects accessed remotely by reference (via dynamically created proxy).
  • Automatic lifetime management between Sips (x-thread, x-process, x-machine).
  • Capability-based security model.
  • Method specifications formalize wire contracts (i.e. explicit application protocols).
  • Flexible Modelling: Methods can pass or return:
    • Any data contract including both primitives and UDTs.
    • Any remotable proxy. Allows methods to pass references to new objects!
    • Any Sequence<T>. Allows bulks transfers, server push, object streaming (with flow control).
    • A Bytes Stream. Allows efficient binary streaming (with flow control).
    • Support for generic interfaces.
    • Idiomatic C# Syntax:
      • Method overload support (two methods with the same name, different parameters).
      • Nullable Reference Types and Nullable<T> parameter support.
      • Optional Argument tunnelling (= default_value attributions are copied to generated proxy and server classes).
      • Attribute tunneling (attributes are copied to generated proxy and server classes).
        • Enables use of features like [MaybeNullWhen].
      • Doc-comment tunneling (doc-comments are copied to generated proxy and server classes).
        • Provide specs on your interface definitions and read them with Intellisense.
[Eventual]
public partial interface IGameLauncher
{
  /// <summary>The game endpoint.</summary>
  public Promise<IPEndPoint> GetEndpoint();

  /// <summary>Returns the first game event whose timestamp is larger than <paramref name="previous"/>.</summary>
  /// <param name="previous">The timestamp of the last game event seen by the caller.</param>
  /// <returns>The game event along with its timestamp.</returns>
  public Sequence<Timestamped<LauncherEvent>> GetNext(ulong previous);

  /// <summary>Attempts to join the game as a player.</summary>
  /// <param name="player">Which player slot to join as.</param>
  /// <param name="name">The name.</param>
  /// <param name="client">A proxy to the player's client.</param>
  /// <returns>Resolves if successfully, broken otherwise.</returns>
  public JoinedPlayerProxy TryJoin(PlayerToken player, string name, ClientLauncherProxy client);


  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Events
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////

  [DataContract]
  public abstract record LauncherEvent();

  /// <summary>The last event indicating the launcher has launched.</summary>
  [DataContract]
  public sealed record LaunchedEvent() : LauncherEvent;
}

/// <summary>A capability to manage a joined player's slot subscription on an active launcher.</summary>
[Eventual]
public partial interface IJoinedPlayer
{
  /// <summary>Removes the player from the game.</summary>
  public Promise Leave();
}

Roslyn Intgegration

  • All features are fully integrated with the Roslyn toolchain and Visual Studio.
  • Dynamic real-time code-gen as you type.
  • Best-practice analyzers and diagnostics.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.0.0.11-preview 35 2/4/2025
1.0.0.10-preview 18 1/29/2025
1.0.0.9-preview 26 1/27/2025
1.0.0.8-preview 32 1/17/2025
1.0.0.4-preview 9 1/15/2025
1.0.0.1-preview 35 1/10/2025