This doesn't quite work yet (the extension of int to take a RollOfDice doesn't compile right), but the syntax is there. For feedback, and those interested:
public class RollOfDice{ public delegate Roll()=>int; public static Random rng = new Random; protected int minimumValue; public int MinimumValue{ get{ return(minimumValue); } } protected int maximumValue; public int MaximumValue{ get{ return(maximumValue); } } public static Create( void -> int rollProcedure, int min, int max) => RollOfDice { local RollOfDice rtn = new RollOfDice; rtn.Roll = rollProcedure; rtn.minimumValue = min; rtn.maximumValue = max; return(rtn); } public static CreateDie( int sides ) => RollOfDice{ return( // bug #67, // static scoping needs full path. RollOfDice.Create( ()=>int{ return( (RollOfDice.rng.Next(sides))+1 ); }, 1, sides ) ); }}// bug #65, custom initializer is fubar'd//public RollOfDice d20 = RollOfDice.CreateDie(20);public RollOfDice d20;public RollOfDice d12;public RollOfDice d10;public RollOfDice d8;public RollOfDice d6;public RollOfDice d4;public static create dice => void { d20 = RollOfDice.CreateDie(20); d12 = RollOfDice.CreateDie(12); d10 = RollOfDice.CreateDie(10); d8 = RollOfDice.CreateDie(8); d6 = RollOfDice.CreateDie(6); d4 = RollOfDice.CreateDie(4);}public static roll (RollOfDice die) => int{ return(die.Roll());}public class int{ public this (RollOfDice die) => RollOfDice{ local int min = die.MinimumValue * this; local int max = die.MaximumValue * this; local void -> int newDie = ()=>int{ local int rtn = 0; foreach(int count in 0 to this){ rtn = rtn + roll die; } return(rtn); } return(RollOfDice.Create(newDie,min,max)); }}public static main()=>void{ create dice; print roll 3d6 "\r\n"; foreach( int x in 0 to 10 ){ print roll d20 "\r\n"; }}