···366366 /// <param name = "parentEngine">The engine in which execute the entry function.</param>
367367 /// <param name = "args">The actual arguments for the entry function.</param>
368368 /// <returns>The value returned by the entry function.</returns>
369369- public PValue Run(Engine parentEngine, PValue[] args)
369369+ public PValue Run(Engine parentEngine, ReadOnlySpan<PValue> args)
370370 {
371371 string entryName = Meta[EntryKey];
372372 if (!Functions.TryGetValue(entryName, out var func))
···377377 EnsureInitialization(parentEngine);
378378379379 return func.Run(parentEngine, args);
380380+ }
381381+382382+ /// <summary>
383383+ /// Executes the application's <see cref = "EntryFunction">entry function</see> in the given <paramref
384384+ /// name = "parentEngine">Engine</paramref> and returns it's result.
385385+ /// </summary>
386386+ /// <param name = "parentEngine">The engine in which execute the entry function.</param>
387387+ /// <param name = "args">The actual arguments for the entry function.</param>
388388+ /// <returns>The value returned by the entry function.</returns>
389389+ public PValue Run(Engine parentEngine, params PValue[] args)
390390+ {
391391+ return Run(parentEngine, args.AsSpan());
380392 }
381393382394 /// <summary>
···507519 /// <seealso cref = "EntryKey" />
508520 /// <seealso cref = "EntryFunction" />
509521 [DebuggerStepThrough]
510510- public PValue IndirectCall(StackContext sctx, PValue[] args)
522522+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
511523 {
512524 return Run(sctx.ParentEngine, args);
513525 }
···7777 /// <param name = "sctx">The stack context in which to invoke the function.</param>
7878 /// <param name = "args">A list of arguments to pass to the function.</param>
7979 /// <returns>The value returned by the function.</returns>
8080- public PValue IndirectCall(StackContext sctx, PValue[] args)
8080+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
8181 {
8282 if (Function.CilImplementation is not {} cilImplementation)
8383 throw new PrexoniteException("CilClosure cannot handle " + Function +
···8686 var callCtx = sctx.ParentApplication == Function.ParentApplication
8787 ? sctx
8888 : CilFunctionContext.New(sctx, Function);
8989- cilImplementation(Function, callCtx, args, SharedVariables, out var result, out _);
8989+ cilImplementation(Function, callCtx, args.ToArray(), SharedVariables, out var result, out _);
9090 return result;
9191 }
9292
+2-2
Prexonite/Closure.cs
···7373 /// <param name = "sctx">The stack context in which to invoke the function.</param>
7474 /// <param name = "args">A list of arguments to pass to the function.</param>
7575 /// <returns>The value returned by the function.</returns>
7676- public virtual PValue IndirectCall(StackContext sctx, PValue[] args)
7676+ public virtual PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
7777 {
7878- var fctx = CreateStackContext(sctx, args);
7878+ var fctx = CreateStackContext(sctx, args.ToArray());
7979 return sctx.ParentEngine.Process(fctx);
8080 }
8181
+6-20
Prexonite/Commands/Concurrency/AsyncSeq.cs
···264264 }
265265266266 //Makes working with select from managed code easier
267267- class PFunc : IIndirectCall
267267+ class PFunc(PFuncImpl f) : IIndirectCall
268268 {
269269- readonly Func<StackContext, PValue[], PValue> _f;
270270-271271- public PFunc(Func<StackContext, PValue[], PValue> f)
272272- {
273273- _f = f;
274274- }
275275-276269 #region Implementation of IIndirectCall
277270278278- public PValue IndirectCall(StackContext sctx, PValue[] args)
279279- {
280280- return _f(sctx, args);
281281- }
271271+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args) => f(sctx, args);
282272283273 #endregion
284274285285- public static implicit operator PValue(PFunc f)
286286- {
287287- return PType.Object.CreatePValue(f);
288288- }
275275+ public static implicit operator PValue(PFunc f) => PType.Object.CreatePValue(f);
289276 }
290277291291- static PValue pfunc(Func<StackContext, PValue[], PValue> f)
292292- {
293293- return new PFunc(f);
294294- }
278278+ static PValue pfunc(PFuncImpl f) => new PFunc(f);
295279280280+ delegate PValue PFuncImpl(StackContext sctx, ReadOnlySpan<PValue> args);
281281+296282 public static PValue RunStatically(StackContext sctx, PValue[] args)
297283 {
298284 var carrier = new ContextCarrier();
···123123 /// <param name = "args">A list of the form [ ref f, arg1, arg2, arg3, ..., argn].<br />
124124 /// Lists and coroutines are expanded.</param>
125125 /// <returns>The result returned by <see cref = "IIndirectCall.IndirectCall" /> or PValue Null if no callable object has been passed.</returns>
126126- public override PValue Run(StackContext sctx, PValue[] args)
126126+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
127127 {
128128- return RunStatically(sctx, args);
129129- }
130130-131131- [DebuggerStepThrough]
132132- public static List<PValue> FlattenArguments(StackContext sctx, PValue[] args)
133133- {
134134- return FlattenArguments(sctx, args, 0);
128128+ return RunStatically(sctx, args.ToArray());
135129 }
136130137131 /// <summary>
···141135 /// <param name = "args">The raw list of arguments to process.</param>
142136 /// <param name = "offset">The offset at which to start processing.</param>
143137 /// <returns>A copy of the argument list with top-level lists expanded.</returns>
144144- public static List<PValue> FlattenArguments(StackContext sctx, PValue[] args, int offset)
138138+ public static List<PValue> FlattenArguments(StackContext sctx, ReadOnlySpan<PValue> args, int offset = 0)
145139 {
146146- args ??= Array.Empty<PValue>();
147147- var iargs = new List<PValue>();
140140+ var iargs = new List<PValue>(args.Length);
148141 for (var i = offset; i < args.Length; i++)
149142 {
150143 var arg = args[i];
+2-2
Prexonite/Commands/Core/CallSubPerform.cs
···4848 /// <param name = "sctx">The stack context in which to execut the command.</param>
4949 /// <param name = "args">The arguments to be passed to the command.</param>
5050 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
5151- public override PValue Run(StackContext sctx, PValue[] args)
5151+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5252 {
5353- return RunStatically(sctx, args);
5353+ return RunStatically(sctx, args.ToArray());
5454 }
55555656 public static PValue RunStatically(StackContext sctx, PValue[] args)
+3-8
Prexonite/Commands/Core/Call_Member.cs
···7272 /// <param name = "args">A list of the form [ obj, id, arg1, arg2, arg3, ..., argn].<br />
7373 /// Lists and coroutines are expanded.</param>
7474 /// <returns>The result returned by the member call.</returns>
7575- public override PValue Run(StackContext sctx, PValue[] args)
7575+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7676 {
7777 if (sctx == null)
7878 throw new ArgumentNullException(nameof(sctx));
···9494 id = args[1].CallToString(sctx);
9595 }
96969797-9898- var iargs = new PValue[args.Length - i];
9999- Array.Copy(args, i, iargs, 0, iargs.Length);
100100-101101- return Run(sctx, args[0], isSet, id, iargs);
9797+ return Run(sctx, args[0], isSet, id, args.Slice(i, args.Length - i));
10298 }
10399104100 /// <summary>
···127123 /// Lists and coroutines are expanded.</param>
128124 /// <returns>The result returned by the member call.</returns>
129125 /// <exception cref = "ArgumentNullException"><paramref name = "sctx" /> is null.</exception>
130130- public PValue Run(StackContext sctx, PValue? obj, bool isSet, string id, params PValue[] args)
126126+ public PValue Run(StackContext sctx, PValue? obj, bool isSet, string id, params ReadOnlySpan<PValue> args)
131127 {
132128 if (obj == null)
133129 return PType.Null.CreatePValue();
134130 if (sctx == null)
135131 throw new ArgumentNullException(nameof(sctx));
136136- args ??= Array.Empty<PValue>();
137132138133 var iargs = new List<PValue>();
139134 foreach (var arg in args)
+2-2
Prexonite/Commands/Core/Call_Tail.cs
···5353 /// <param name = "sctx">The stack context in which to execut the command.</param>
5454 /// <param name = "args">The arguments to be passed to the command.</param>
5555 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
5656- public override PValue Run(StackContext sctx, PValue[]? args)
5656+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5757 {
5858 if (sctx == null)
5959 throw new ArgumentNullException(nameof(sctx));
···7979 return Call.CreateStackContext(sctx, args[0], iargs.ToArray());
8080 }
81818282- static List<PValue> make_tailcall(StackContext sctx, PValue[] args)
8282+ static List<PValue> make_tailcall(StackContext sctx, ReadOnlySpan<PValue> args)
8383 {
8484 var iargs = Call.FlattenArguments(sctx, args, 1);
8585
+1-1
Prexonite/Commands/Core/Caller.cs
···4747 /// <param name = "sctx">The stack contetx that wishes to find out, who called him.</param>
4848 /// <param name = "args">Ignored</param>
4949 /// <returns>Either the stack context of the caller or null encapsulated in a PValue.</returns>
5050- public override PValue Run(StackContext sctx, PValue[] args)
5050+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5151 {
5252 return sctx.CreateNativePValue(GetCaller(sctx));
5353 }
···6464 /// <param name = "sctx">The stack context in which to execute the command.</param>
6565 /// <param name = "args">The arguments to be passed to the command.</param>
6666 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
6767- public override PValue Run(StackContext sctx, PValue[] args)
6767+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6868 {
6969- return RunStatically(sctx, args);
6969+ return RunStatically(sctx, args.ToArray());
7070 }
71717272 /// <summary>
+3-3
Prexonite/Commands/Core/Concat.cs
···5252 /// <remarks>
5353 /// Please note that this method uses a string builder. The addition operator is faster for only two fragments.
5454 /// </remarks>
5555- public static string ConcatenateString(StackContext sctx, PValue[] args)
5555+ public static string ConcatenateString(StackContext sctx, ReadOnlySpan<PValue> args)
5656 {
5757 var elements = new string[args.Length];
5858 for (var i = 0; i < args.Length; i++)
···8585 /// <param name = "sctx">The context in which to convert the arguments to strings.</param>
8686 /// <param name = "args">The list of fragments to concatenate.</param>
8787 /// <returns>A PValue containing the concatenated string.</returns>
8888- public override PValue Run(StackContext sctx, PValue[] args)
8888+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
8989 {
9090- return RunStatically(sctx, args);
9090+ return RunStatically(sctx, args.ToArray());
9191 }
92929393 #region ICilCompilerAware Members
+2-2
Prexonite/Commands/Core/ConsolePrint.cs
···6262 /// <param name = "sctx">The stack context in which to execut the command.</param>
6363 /// <param name = "args">The arguments to be passed to the command.</param>
6464 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
6565- public override PValue Run(StackContext sctx, PValue[] args)
6565+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6666 {
6767- return RunStatically(sctx, args);
6767+ return RunStatically(sctx, args.ToArray());
6868 }
69697070 #region ICilCompilerAware Members
+2-2
Prexonite/Commands/Core/ConsolePrintLine.cs
···6363 /// <param name = "sctx">The stack context in which to execut the command.</param>
6464 /// <param name = "args">The arguments to be passed to the command.</param>
6565 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
6666- public override PValue Run(StackContext sctx, PValue[] args)
6666+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6767 {
6868- return RunStatically(sctx, args);
6868+ return RunStatically(sctx, args.ToArray());
6969 }
70707171 #region ICilCompilerAware Members
···4747 /// <param name = "sctx">The stack context in which to load the assembly</param>
4848 /// <param name = "args">A list of file paths to assemblies.</param>
4949 /// <returns>Null</returns>
5050- public override PValue Run(StackContext sctx, PValue[] args)
5050+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5151 {
5252- return RunStatically(sctx, args);
5252+ return RunStatically(sctx, args.ToArray());
5353 }
54545555 public static PValue RunStatically(StackContext sctx, PValue[] args)
+1-1
Prexonite/Commands/Core/Meta.cs
···6868 /// <param name = "sctx">The stack context in which to execut the command.</param>
6969 /// <param name = "args">The arguments to be passed to the command.</param>
7070 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
7171- public override PValue Run(StackContext sctx, PValue[]? args)
7171+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7272 {
7373 if (sctx == null)
7474 throw new ArgumentNullException(nameof(sctx));
+1-1
Prexonite/Commands/Core/Not.cs
···88 {
99 }
10101111- public override PValue Run(StackContext sctx, PValue[] args)
1111+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
1212 {
1313 foreach (var arg in args)
1414 {
···2424// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
2525// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26262727+using System.Collections.Immutable;
2728using System.Diagnostics;
28292930namespace Prexonite.Commands.Core.PartialApplication;
···133134 System.Diagnostics.Debug.Assert(mapping != 0);
134135 }
135136136136- public virtual PValue IndirectCall(StackContext sctx, PValue[] args)
137137+ public virtual PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
137138 {
138139 _combineArguments(args, out var nonArguments, out var effectiveArguments);
139140140141 return Invoke(sctx, nonArguments, effectiveArguments);
141142 }
142143143143- void _combineArguments(PValue[] args, out PValue[] nonArguments,
144144+ void _combineArguments(ReadOnlySpan<PValue> args, out PValue[] nonArguments,
144145 out PValue[] effectiveArguments)
145146 {
146146- System.Diagnostics.Debug.Assert(args.All(value => (PValue?)value != null),
147147+ System.Diagnostics.Debug.Assert(args.ToImmutableArray().All(value => (PValue?)value != null),
147148 "Actual (CLI) null references passed to " +
148149 GetType().Name + ".IndirectCall");
149150
···5656 /// <param name = "sctx">The context in which to convert the arguments to strings.</param>
5757 /// <param name = "args">The list of arguments to print.</param>
5858 /// <returns></returns>
5959- public override PValue Run(StackContext sctx, PValue[] args)
5959+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6060 {
6161 var s = Concat.ConcatenateString(sctx, args);
6262 _writer.Write(s);
+1-1
Prexonite/Commands/Core/PrintLine.cs
···5656 /// <param name = "sctx">The context in which to convert the arguments to strings.</param>
5757 /// <param name = "args">The list of arguments to print.</param>
5858 /// <returns></returns>
5959- public override PValue Run(StackContext sctx, PValue[] args)
5959+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6060 {
6161 var s = Concat.ConcatenateString(sctx, args);
6262
+2-2
Prexonite/Commands/Core/StaticPrint.cs
···7171 /// <param name = "sctx">The stack context in which to execut the command.</param>
7272 /// <param name = "args">The arguments to be passed to the command.</param>
7373 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
7474- public override PValue Run(StackContext sctx, PValue[] args)
7474+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7575 {
7676- return RunStatically(sctx, args);
7676+ return RunStatically(sctx, args.ToArray());
7777 }
78787979 #region ICilCompilerAware Members
+2-2
Prexonite/Commands/Core/StaticPrintLine.cs
···6262 /// <param name = "sctx">The stack context in which to execut the command.</param>
6363 /// <param name = "args">The arguments to be passed to the command.</param>
6464 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
6565- public override PValue Run(StackContext sctx, PValue[] args)
6565+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6666 {
6767- return RunStatically(sctx, args);
6767+ return RunStatically(sctx, args.ToArray());
6868 }
69697070 #region ICilCompilerAware Members
+1-1
Prexonite/Commands/Core/Unbind.cs
···8484 /// Each of the supplied arguments is processed individually.
8585 /// </remarks>
8686 /// <exception cref = "ArgumentNullException">args is null</exception>
8787- public override PValue Run(StackContext sctx, PValue[] args)
8787+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
8888 {
8989 if (args == null)
9090 throw new ArgumentNullException(nameof(args));
+2-2
Prexonite/Commands/CoroutineCommand.cs
···3636 /// <param name = "sctx">The stack context in which to execut the command.</param>
3737 /// <param name = "args">The arguments to be passed to the command.</param>
3838 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
3939- public override PValue Run(StackContext sctx, PValue[] args)
3939+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
4040 {
4141 if (sctx == null)
4242 throw new ArgumentNullException(nameof(sctx));
···4444 throw new ArgumentNullException(nameof(args));
45454646 var carrier = new ContextCarrier();
4747- var corctx = new CoroutineContext(sctx, CoroutineRun(carrier, args));
4747+ var corctx = new CoroutineContext(sctx, CoroutineRun(carrier, args.ToArray()));
4848 carrier.StackContext = corctx;
4949 return sctx.CreateNativePValue(new Coroutine(corctx));
5050 }
+2-2
Prexonite/Commands/DelegatePCommand.cs
···5353 /// <param name = "sctx">The stack context in which to execute the command.</param>
5454 /// <param name = "args">The array of arguments to pass to the command.</param>
5555 /// <returns></returns>
5656- public override PValue Run(StackContext sctx, PValue[] args)
5656+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5757 {
5858- return Action(sctx, args);
5858+ return Action(sctx, args.ToArray());
5959 }
60606161 /// <summary>
···5151 /// <param name = "sctx">The stack context in which to execut the command.</param>
5252 /// <param name = "args">The arguments to be passed to the command.</param>
5353 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
5454- public override PValue Run(StackContext sctx, PValue[] args)
5454+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5555 {
5656- return RunStatically(sctx, args);
5656+ return RunStatically(sctx, args.ToArray());
5757 }
58585959 // ReSharper disable MemberCanBePrivate.Global
···28282929public class Exists : PCommand
3030{
3131- public override PValue Run(StackContext sctx, PValue[] args)
3131+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
3232 {
3333 if (sctx == null)
3434 throw new ArgumentNullException(nameof(sctx));
+1-1
Prexonite/Commands/List/FlatMap.cs
···3939 var xs = Map._ToEnumerable(sctx, arg);
4040 foreach (var x in xs)
4141 {
4242- var rawYs = f != null ? f.IndirectCall(sctx, new[] {x}) : x;
4242+ var rawYs = f != null ? f.IndirectCall(sctx, x) : x;
4343 var ys = Map._ToEnumerable(sctx, rawYs);
4444 foreach (var y in ys)
4545 {
+3-3
Prexonite/Commands/List/FoldL.cs
···61616262 foreach (var right in source)
6363 {
6464- left = f.IndirectCall(sctx, new[] {left, right});
6464+ left = f.IndirectCall(sctx, left, right);
6565 }
6666 return left;
6767 }
···104104 return Run(sctx, f, left ?? PType.Null, source);
105105 }
106106107107- public override PValue Run(StackContext sctx, PValue[] args)
107107+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
108108 {
109109- return RunStatically(sctx, args);
109109+ return RunStatically(sctx, args.ToArray());
110110 }
111111112112 #region ICilCompilerAware Members
+3-3
Prexonite/Commands/List/FoldR.cs
···66666767 for (var i = lst.Count - 1; i >= 0; i--)
6868 {
6969- right = f.IndirectCall(sctx, new[] {lst[i], right});
6969+ right = f.IndirectCall(sctx, lst[i], right);
7070 }
7171 return right;
7272 }
73737474- public override PValue Run(StackContext sctx, PValue[] args)
7474+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7575 {
7676- return RunStatically(sctx, args);
7676+ return RunStatically(sctx, args.ToArray());
7777 }
78787979 public static PValue RunStatically(StackContext sctx, PValue[] args)
+1-1
Prexonite/Commands/List/ForAll.cs
···28282929public class ForAll : PCommand
3030{
3131- public override PValue Run(StackContext sctx, PValue[] args)
3131+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
3232 {
3333 if (sctx == null)
3434 throw new ArgumentNullException(nameof(sctx));
+1-1
Prexonite/Commands/List/GroupBy.cs
···5454 continue;
5555 foreach (var x in xs)
5656 {
5757- var fx = f.IndirectCall(sctx, new[] {x});
5757+ var fx = f.IndirectCall(sctx, x);
5858 if (!groups.ContainsKey(fx))
5959 {
6060 var lst = new List<PValue>();
···6565 /// <param name = "sctx">The stack context in which to execut the command.</param>
6666 /// <param name = "args">The arguments to be passed to the command.</param>
6767 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
6868- public override PValue Run(StackContext sctx, PValue[] args)
6868+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
6969 {
7070- return RunStatically(sctx, args);
7070+ return RunStatically(sctx, args.ToArray());
7171 }
72727373 #region ICilCompilerAware Members
+1-1
Prexonite/Commands/List/Map.cs
···119119 var sctx = sctxCarrier.StackContext;
120120121121 foreach (var x in source)
122122- yield return f != null ? f.IndirectCall(sctx, new[] {x}) : x;
122122+ yield return f != null ? f.IndirectCall(sctx, x) : x;
123123 }
124124125125 /// <summary>
+2-2
Prexonite/Commands/List/Sort.cs
···5252 /// <param name = "sctx">The stack context in which the sort is performed.</param>
5353 /// <param name = "args">A list of sort expressions followed by the list to sort.</param>
5454 /// <returns>The a sorted copy of the list.</returns>
5555- public override PValue Run(StackContext sctx, PValue[] args)
5555+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5656 {
5757 if (sctx == null)
5858 throw new ArgumentNullException(nameof(sctx));
···7676 {
7777 foreach (var f in clauses)
7878 {
7979- var pdec = f.IndirectCall(sctx, new[] {a, b});
7979+ var pdec = f.IndirectCall(sctx, a, b);
8080 if (pdec.Type is not IntPType)
8181 pdec = pdec.ConvertTo(sctx, PType.Int);
8282 var dec = (int) pdec.Value!;
···7373 foreach (var value in set)
7474 if (
7575 (bool)
7676- f.IndirectCall(sctx, new[] {value, i++}).ConvertTo(sctx, PType.Bool,
7676+ f.IndirectCall(sctx, value, i++).ConvertTo(sctx, PType.Bool,
7777 true).Value!)
7878 yield return value;
7979 }
+1-1
Prexonite/Commands/List/Where.cs
···8181 continue;
8282 foreach (var value in set)
8383 {
8484- var include = f.IndirectCall(sctx, new[] {value}).ConvertTo(sctx, PType.Bool,
8484+ var include = f.IndirectCall(sctx, value).ConvertTo(sctx, PType.Bool,
8585 true);
8686 if ((bool) include.Value!)
8787 yield return value;
+2-2
Prexonite/Commands/Math/Abs.cs
···4949 /// <param name = "sctx">The stack context in which to execut the command.</param>
5050 /// <param name = "args">The arguments to be passed to the command.</param>
5151 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
5252- public override PValue Run(StackContext sctx, PValue[] args)
5252+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5353 {
5454- return RunStatically(sctx, args);
5454+ return RunStatically(sctx, args.ToArray());
5555 }
56565757 /// <summary>
···9191 /// <param name = "sctx">The stack context in which to execut the command.</param>
9292 /// <param name = "args">The arguments to be passed to the command.</param>
9393 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
9494- public override PValue Run(StackContext sctx, PValue[] args)
9494+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
9595 {
9696- return RunStatically(sctx, args);
9696+ return RunStatically(sctx, args.ToArray());
9797 }
98989999 #region ICilCompilerAware Members
+2-2
Prexonite/Commands/Math/Min.cs
···9090 /// <param name = "sctx">The stack context in which to execut the command.</param>
9191 /// <param name = "args">The arguments to be passed to the command.</param>
9292 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
9393- public override PValue Run(StackContext sctx, PValue[] args)
9393+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
9494 {
9595- return RunStatically(sctx, args);
9595+ return RunStatically(sctx, args.ToArray());
9696 }
97979898 #region ICilCompilerAware Members
+1-1
Prexonite/Commands/Math/Pi.cs
···4747 /// <param name = "sctx">The stack context in which to execut the command.</param>
4848 /// <param name = "args">The arguments to be passed to the command.</param>
4949 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
5050- public override PValue Run(StackContext sctx, PValue[] args)
5050+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5151 {
5252 return System.Math.PI;
5353 }
+2-2
Prexonite/Commands/Math/Round.cs
···8484 /// <param name = "sctx">The stack context in which to execut the command.</param>
8585 /// <param name = "args">The arguments to be passed to the command.</param>
8686 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
8787- public override PValue Run(StackContext sctx, PValue[] args)
8787+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
8888 {
8989- return RunStatically(sctx, args);
8989+ return RunStatically(sctx, args.ToArray());
9090 }
91919292 #region ICilCompilerAware Members
···5555 /// <param name = "sctx">The stack context in which to execute the command.</param>
5656 /// <param name = "args">The arguments to pass to the command invocation.</param>
5757 /// <returns>The value returned by <c><see cref = "Action" />.Run</c>.</returns>
5858- public override PValue Run(StackContext sctx, PValue[] args)
5858+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
5959 {
6060 return Action.Run(sctx, args);
6161 }
···8989 /// <remarks>
9090 /// If your implementation does not return a value, you have to return <c>PType.Null.CreatePValue()</c> and <strong>not</strong> <c>null</c>!
9191 /// </remarks>
9292- PValue Run(StackContext sctx, PValue[] args);
9292+ PValue Run(StackContext sctx, ReadOnlySpan<PValue> args);
9393}
+5-3
Prexonite/Commands/PCommand.cs
···3737 /// <param name = "sctx">The stack context in which to execut the command.</param>
3838 /// <param name = "args">The arguments to be passed to the command.</param>
3939 /// <returns>The value returned by the command. Must not be null. (But possibly {null~Null})</returns>
4040- public abstract PValue Run(StackContext sctx, PValue[] args);
4040+ public abstract PValue Run(StackContext sctx, ReadOnlySpan<PValue> args);
4141+4242+ public PValue Run(StackContext sctx, params PValue[] args) => Run(sctx, new ReadOnlySpan<PValue>(args));
41434244 #region IIndirectCall Members
43454446 /// <summary>
4545- /// Runs the command. (Calls <see cref = "Run" />)
4747+ /// Runs the command. (Calls <see cref = "Run(Prexonite.StackContext,System.ReadOnlySpan{Prexonite.PValue})" />)
4648 /// </summary>
4749 /// <param name = "sctx">The stack context in which to call the command.</param>
4850 /// <param name = "args">The arguments to pass to the command.</param>
4951 /// <returns>The value returned by the command.</returns>
5050- PValue IIndirectCall.IndirectCall(StackContext sctx, PValue[] args)
5252+ PValue IIndirectCall.IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
5153 {
5254 return Run(sctx, args) ?? PType.Null.CreatePValue();
5355 }
···2828using System.Diagnostics;
2929using System.Reflection;
3030using System.Reflection.Emit;
3131+using System.Runtime.Loader;
3132using Prexonite.Modular;
32333334#endregion
···4748 return applicationId + "_" + Interlocked.Increment(ref _numberOfPasses) + "";
4849 }
49505050- readonly AssemblyBuilder? _assemblyBuilder;
5151+ readonly PersistedAssemblyBuilder? _assemblyBuilder;
51525252- public AssemblyBuilder Assembly
5353+ public PersistedAssemblyBuilder Assembly
5354 {
5455 [DebuggerStepThrough]
5556 get
···9697 {
9798 var sequenceName = _createNextTypeName(app?.Id);
9899 var asmName = new AssemblyName(sequenceName);
9999- _assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndCollect);
100100+ _assemblyBuilder = new PersistedAssemblyBuilder(asmName, typeof(object).Assembly) {
101101+102102+ };
103103+100104 _moduleBuilder = _assemblyBuilder.DefineDynamicModule(asmName.Name!);
101105 _typeBuilder = _moduleBuilder.DefineType(sequenceName);
102106 }
···270274271275 Type _getRuntimeType()
272276 {
273273- return _cachedTypeReference ??= TargetType.CreateType();
277277+ if (_cachedTypeReference == null)
278278+ {
279279+ if (!MakeAvailableForLinking)
280280+ {
281281+ throw new PrexoniteException("Cannot get CIL implementation type when static linking is not enabled.");
282282+ }
283283+284284+ // Emit type IL
285285+ _ = TargetType.CreateType();
286286+287287+ // Unlike the old .NET implementation of Reflection.Emit, we have to decide between
288288+ // a persisted and a runtime assembly builder. They are essentially two separate implementations of the
289289+ // Reflection.Emit interface. The persisted assembly builder has the drawback that the types it generates
290290+ // cannot be used without serializing the IL and loading it as an assembly.
291291+ // It's a bit misleading that Microsoft kept the old Reflection.Emit API where `CreateType` returns a "Type".
292292+ // That type is secretly still a type builder and can thus not be used with Delegate.CreateDelegate.
293293+ using var mem = new MemoryStream();
294294+ _assemblyBuilder.Save(mem);
295295+ mem.Seek(0, SeekOrigin.Begin);
296296+ var ldCtx = AssemblyLoadContext.GetLoadContext(typeof(CompilerPass).Assembly)
297297+ ?? throw new PrexoniteException("Failed to construct assembly load context.");
298298+ var loaded = ldCtx.LoadFromStream(mem);
299299+300300+ _cachedTypeReference = loaded.GetType(TargetType.FullName!, throwOnError: true)
301301+ ?? throw new PrexoniteException("Generated assembly did not contain the type that holds CIL implementations.");
302302+ }
303303+304304+ return _cachedTypeReference;
274305 }
275306276307 public void LinkMetadata(PFunction func)
+17-15
Prexonite/Compiler/Cil/CompilerState.cs
···402402 /// <param name = "index">The index of the local variable to load.</param>
403403 public void EmitLoadLocal(int index)
404404 {
405405+ // TODO: for yet unknown reasons using the short versions of ldloc causes System.Reflection.Emit
406406+ // to generate invalid IL (an instruction gets missing after being emitted).
405407 switch (index)
406408 {
407407- case 0:
408408- Il.Emit(OpCodes.Ldloc_0);
409409- break;
410410- case 1:
411411- Il.Emit(OpCodes.Ldloc_1);
412412- break;
413413- case 2:
414414- Il.Emit(OpCodes.Ldloc_2);
415415- break;
416416- case 3:
417417- Il.Emit(OpCodes.Ldloc_3);
418418- break;
409409+ // case 0:
410410+ // Il.Emit(OpCodes.Ldloc_0);
411411+ // break;
412412+ // case 1:
413413+ // Il.Emit(OpCodes.Ldloc_1);
414414+ // break;
415415+ // case 2:
416416+ // Il.Emit(OpCodes.Ldloc_2);
417417+ // break;
418418+ // case 3:
419419+ // Il.Emit(OpCodes.Ldloc_3);
420420+ // break;
419421 default:
420420- if (index < byte.MaxValue)
421421- Il.Emit(OpCodes.Ldloc_S, (byte) index);
422422- else
422422+ // if (index < byte.MaxValue)
423423+ // Il.Emit(OpCodes.Ldloc_S, (byte) index);
424424+ // else
423425 Il.Emit(OpCodes.Ldloc, index);
424426 break;
425427 }
···66666767 const int CallingConventionArgumentsCount = 4;
68686969- public override PValue Run(StackContext sctx, PValue[] args)
6969+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7070 {
7171 if (args.Length < CallingConventionArgumentsCount)
7272 throw new PrexoniteException(
+1-1
Prexonite/Compiler/Macro/Commands/Reference.cs
···73737474 #region Overrides of PCommand
75757676- public override PValue Run(StackContext sctx, PValue[] args)
7676+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
7777 {
7878 if (args.Length < 3)
7979 throw new PrexoniteException(string.Format(
+1-1
Prexonite/Compiler/Macro/Commands/Unpack.cs
···96969797 #region Overrides of PCommand
98989999- public override PValue Run(StackContext sctx, PValue[] args)
9999+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
100100 {
101101 MacroContext? context;
102102 if (args.Length < 2 || args[0].Type is not ObjectPType ||
+8-2
Prexonite/Compiler/Symbolic/Namespace.cs
···1212 public abstract IEnumerator<KeyValuePair<string, Symbol>> GetEnumerator();
1313 public abstract bool IsEmpty { get; }
1414 public abstract bool TryGet(string id, [NotNullWhen(true)] out Symbol? value);
1515- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id, out PValue result)
1515+ public bool TryDynamicCall(
1616+ StackContext sctx,
1717+ ReadOnlySpan<PValue> args,
1818+ PCall call,
1919+ string id,
2020+ out PValue result
2121+ )
1622 {
1723 if ("TRYGET".Equals(id, StringComparison.InvariantCultureIgnoreCase))
1824 {
···2430 var found = TryGet(args[0].CallToString(sctx), out var symbol);
2531 if (args.Length >= 2)
2632 {
2727- args[1].IndirectCall(sctx, new[] {sctx.CreateNativePValue(symbol)});
3333+ args[1].IndirectCall(sctx, sctx.CreateNativePValue(symbol));
2834 }
29353036 result = sctx.CreateNativePValue(found);
+9-3
Prexonite/Compiler/Symbolic/Symbol.cs
···153153 }
154154 public abstract override int GetHashCode();
155155156156- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id, out PValue result)
156156+ public bool TryDynamicCall(
157157+ StackContext sctx,
158158+ ReadOnlySpan<PValue> args,
159159+ PCall call,
160160+ string id,
161161+ out PValue result
162162+ )
157163 {
158158- static PValue assignOutParameter(StackContext stackContext, PValue[] innerArgs, object? value, bool found)
164164+ static PValue assignOutParameter(StackContext stackContext, ReadOnlySpan<PValue> innerArgs, object? value, bool found)
159165 {
160166 if (innerArgs.Length > 0)
161167 {
162168 var wrappedValue = found ? stackContext.CreateNativePValue(value) : PType.Null;
163163- innerArgs[0].IndirectCall(stackContext, new[] {wrappedValue});
169169+ innerArgs[0].IndirectCall(stackContext, wrappedValue);
164170 }
165171 return stackContext.CreateNativePValue(found);
166172 }
+8-2
Prexonite/Compiler/Symbolic/SymbolStore.cs
···129129130130 #region Implementation of IObject
131131132132- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id, out PValue result)
132132+ public bool TryDynamicCall(
133133+ StackContext sctx,
134134+ ReadOnlySpan<PValue> args,
135135+ PCall call,
136136+ string id,
137137+ out PValue result
138138+ )
133139 {
134140 switch (id.ToUpperInvariant())
135141 {
···143149 var symbolic = (string)args[0].ConvertTo(sctx, PType.String, useExplicit: false).Value!;
144150 if(TryGet(symbolic,out var symbol))
145151 {
146146- args[1].IndirectCall(sctx, new[] {sctx.CreateNativePValue(symbol)});
152152+ args[1].IndirectCall(sctx, sctx.CreateNativePValue(symbol));
147153 result = true;
148154 return true;
149155 }
+10-4
Prexonite/Concurrency/Channel.cs
···3232{
3333 #region Implementation of IObject
34343535- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id,
3636- [NotNullWhen(true)] out PValue? result)
3535+ public bool TryDynamicCall(
3636+ StackContext sctx,
3737+ ReadOnlySpan<PValue> args,
3838+ PCall call,
3939+ string id,
4040+ [NotNullWhen(true)]
4141+ out PValue? result
4242+ )
3743 {
3844 result = null;
3945 switch (id.ToUpperInvariant())
···5258 var refVar = (args.Length > 0 ? args[0] : null) ?? PType.Null;
5359 if (TryReceive(out var datum))
5460 {
5555- refVar.IndirectCall(sctx, new[] {datum});
6161+ refVar.IndirectCall(sctx, datum);
5662 result = true;
5763 }
5864 else
5965 {
6060- refVar.IndirectCall(sctx, new PValue[] {PType.Null});
6666+ refVar.IndirectCall(sctx, PType.Null);
6167 result = false;
6268 }
6369 break;
+2-2
Prexonite/Continuation.cs
···7373 return sharedVariables;
7474 }
75757676- public override PValue IndirectCall(StackContext sctx, PValue[] args)
7676+ public override PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
7777 {
7878 if (sctx == null)
7979 throw new ArgumentNullException(nameof(sctx));
8080 if (args == null)
8181 throw new ArgumentNullException(nameof(args));
82828383- var fctx = CreateFunctionContext(sctx, args);
8383+ var fctx = CreateFunctionContext(sctx, args.ToArray());
84848585 //run the continuation
8686 return sctx.ParentEngine.Process(fctx);
+8-2
Prexonite/Coroutine.cs
···120120 /// <returns>True if a member has been called; false otherwise.</returns>
121121 [SuppressMessage("ReSharper", "ObjectProducedWithMustDisposeAnnotatedMethodIsNotDisposed")]
122122 public bool TryDynamicCall(
123123- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
123123+ StackContext sctx,
124124+ ReadOnlySpan<PValue> args,
125125+ PCall call,
126126+ string id,
127127+ [NotNullWhen(true)]
128128+ out PValue? result
129129+ )
124130 {
125131 switch (id.ToLower())
126132 {
···160166 /// This method returns <see cref = "PType.Null" /> PValue if the coroutine is
161167 /// no longer valid.
162168 /// </remarks>
163163- public PValue IndirectCall(StackContext sctx, PValue[] args)
169169+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
164170 {
165171 return Execute(sctx);
166172 }
+1-1
Prexonite/Helper/DependencyEntity.cs
···45454646 return value =>
4747 {
4848- var depsPv = getDependenciesPv.IndirectCall(sctx, new[] {value});
4848+ var depsPv = getDependenciesPv.IndirectCall(sctx, value);
49495050 var depsDynamic = Map._ToEnumerable(sctx, depsPv);
5151 if (depsDynamic == null)
+39
Prexonite/Helper/Extensions.cs
···119119 }
120120121121 /// <summary>
122122+ /// Constructs a human-readable enumeration of the form "x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub>, …, x<sub>n-2</sub>, x<sub>n-1</sub>, and x<sub>n</sub>".
123123+ /// </summary>
124124+ /// <typeparam name="T">Any type that supports <see cref="Object.ToString"/>.</typeparam>
125125+ /// <param name="source">The enumeration to convert to a string.</param>
126126+ /// <returns>A human-readable string.</returns>
127127+ public static string? ToEnumerationString<T>(this ReadOnlySpan<T> source)
128128+ {
129129+ var s = new StringBuilder();
130130+ var hasStarted = false;
131131+ string? hold = null;
132132+ foreach (var x in source)
133133+ {
134134+ if (hold != null)
135135+ if (hasStarted)
136136+ {
137137+ s.Append(", ");
138138+ s.Append(hold);
139139+ }
140140+ else
141141+ {
142142+ s.Append(hold);
143143+ hasStarted = true;
144144+ }
145145+ hold = x?.ToString() ?? "";
146146+ }
147147+148148+ if (hasStarted)
149149+ {
150150+ s.Append(" and ");
151151+ s.Append(hold);
152152+ return s.ToString();
153153+ }
154154+ else
155155+ {
156156+ return hold;
157157+ }
158158+ }
159159+160160+ /// <summary>
122161 /// Constructs a machine-readable, comma-separated list. ("x<sub>1</sub>, x<sub>2</sub>, …, x<sub>n</sub>").
123162 /// </summary>
124163 /// <typeparam name="T">Any type that supports <see cref="Object.ToString"/>.</typeparam>
+6-1
Prexonite/IIndirectCall.cs
···2929 /// </para>
3030 /// </remarks>
3131 /// <returns>The result of the call. Should <strong>never</strong> be null.</returns>
3232- PValue IndirectCall(StackContext sctx, PValue[] args);
3232+ PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args);
3333+}
3434+3535+public static class IndirectCallExt
3636+{
3737+ public static PValue IndirectCall(this IIndirectCall t, StackContext sctx, PValue[] args) => t.IndirectCall(sctx, new ReadOnlySpan<PValue>(args));
3338}
+1
Prexonite/IMaybeStackAware.cs
···2121 bool TryDefer(StackContext sctx, PValue[] args,
2222 [NotNullWhen(true)] out StackContext? partialApplicationContext,
2323 [NotNullWhen(false)] out PValue? result);
2424+ // TODO ReadOnlySpan this
2425}
+19-6
Prexonite/PFunction.cs
···303303 /// <param name = "sharedVariables">The list of variables shared with the caller.</param>
304304 /// <returns>The value returned by the function or {null~Null}</returns>
305305 [PublicAPI]
306306- public PValue Run(Engine engine, PValue[]? args, PVariable[]? sharedVariables)
306306+ public PValue Run(Engine engine, ReadOnlySpan<PValue> args, PVariable[]? sharedVariables)
307307 {
308308+ var allocatedArgs = args.ToArray();
308309 if (CilImplementation is {} cilImplementation)
309310 {
310311 //Fix #8
···313314 (
314315 this,
315316 new NullContext(engine, ParentApplication, ImportedNamespaces),
316316- args ?? [],
317317+ allocatedArgs,
317318 sharedVariables,
318319 out var result, out _);
319320 return result;
320321 }
321322 else
322323 {
323323- var fctx = CreateFunctionContext(engine, args, sharedVariables);
324324+ var fctx = CreateFunctionContext(engine, allocatedArgs, sharedVariables);
324325 engine.Stack.AddLast(fctx);
325326 return engine.Process();
326327 }
328328+ }
329329+330330+ [Obsolete("Use the overload that takes a ReadOnlySpan instead.")]
331331+ public PValue Run(Engine engine, PValue[] args, PVariable[]? sharedVariables)
332332+ {
333333+ return Run(engine, args.AsSpan(), sharedVariables);
327334 }
328335329336 /// <summary>
···334341 /// <returns>A function context for the execution of this function.</returns>
335342 /// <returns>The value returned by the function or {null~Null}</returns>
336343 [PublicAPI]
337337- public PValue Run(Engine engine, PValue[]? args)
344344+ public PValue Run(Engine engine, ReadOnlySpan<PValue> args)
338345 {
339346 return Run(engine, args, null);
340347 }
341348349349+ [Obsolete("Use the overload that takes a ReadOnlySpan instead.")]
350350+ public PValue Run(Engine engine, PValue[]? args)
351351+ {
352352+ return Run(engine, args.AsSpan(), null);
353353+ }
354354+342355 /// <summary>
343356 /// Executes the function on the supplied engine and returns the result.
344357 /// </summary>
···348361 [PublicAPI]
349362 public PValue Run(Engine engine)
350363 {
351351- return Run(engine, null);
364364+ return Run(engine, [], null);
352365 }
353366354367 #endregion
···361374 /// <param name = "sctx">The stack context from which the function is called.</param>
362375 /// <param name = "args">The list of arguments to be passed to the function.</param>
363376 /// <returns>The value returned by the function or {null~Null}</returns>
364364- PValue IIndirectCall.IndirectCall(StackContext sctx, PValue[]? args)
377377+ PValue IIndirectCall.IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
365378 {
366379 return Run(sctx.ParentEngine, args);
367380 }
+51-10
Prexonite/PValue.cs
···131131 /// <returns>The value returned by the dynamic (instance) call. In case the call does not have a return value, a PValue containing null is returned.</returns>
132132 /// <exception cref = "InvalidCallException">Thrown if the call is not successful.</exception>
133133 [DebuggerStepThrough]
134134- public PValue DynamicCall(StackContext sctx, PValue[] args, PCall call, string id)
134134+ public PValue DynamicCall(StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id)
135135 {
136136 return Type.DynamicCall(sctx, this, args, call, id);
137137 }
138138139139+ [Obsolete("Use the overload with ReadOnlySpan<PValue> instead.")]
140140+ public PValue DynamicCall(
141141+ StackContext sctx,
142142+ PValue[] args,
143143+ PCall call,
144144+ string id
145145+ ) => DynamicCall(sctx, args.AsSpan(), call, id);
146146+139147 /// <summary>
140148 /// Tries to perform a dynamic (instance) call on the value and stores the result in the out parameter <paramref
141149 /// name = "result" />.
···153161 /// </remarks>
154162 [DebuggerStepThrough]
155163 public bool TryDynamicCall(
156156- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
164164+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
157165 {
158166 return Type.TryDynamicCall(sctx, this, args, call, id, out result);
159167 }
168168+169169+ /// <summary>
170170+ /// Tries to perform a dynamic (instance) call on the value and stores the result in the out parameter <paramref
171171+ /// name = "result" />.
172172+ /// </summary>
173173+ /// <param name = "sctx">The stack context in which to perform the call.</param>
174174+ /// <param name = "args">An array of arguments to be passed in the call.</param>
175175+ /// <param name = "call">The semantic context of the call. <see cref = "PCall.Get" /> and <see cref = "PCall.Set" /> will have the same effect in most cases. See the TryDynamicCall of <see
176176+ /// cref = "PType" /> implementors for details.</param>
177177+ /// <param name = "id">The name of the member to call. <paramref name = "id" /> might or might not be case sensitive, depending on the PType.
178178+ /// The string can be empty if you want to call the default member (C# only supports default indexers).</param>
179179+ /// <param name = "result">Contains the value returned by the dynamic (instance) call. In case the call does not have a return value, a PValue containing null is returned.</param>
180180+ /// <returns>True if the call was successful, false otherwise.</returns>
181181+ /// <remarks>
182182+ /// Note that the value of <paramref name = "result" /> is undefined (and therefor not to be used) if the method call returned false.
183183+ /// </remarks>
184184+ [DebuggerStepThrough]
185185+ [Obsolete("Use the overload with ReadOnlySpan<PValue> instead.")]
186186+ public bool TryDynamicCall(
187187+ StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result) =>
188188+ TryDynamicCall(sctx, args.AsSpan(), call, id, out result);
160189161190 /// <summary>
162191 /// Performs a conversion on the value and returns the resulting PValue. You should use <see
···377406 /// Note that the value of <paramref name = "result" /> is undefined (and therefor not to be used) if the method call returned false.
378407 /// </remarks>
379408 [DebuggerStepThrough]
380380- public bool TryIndirectCall(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
409409+ public bool TryIndirectCall(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
381410 {
382411 return Type.IndirectCall(sctx, this, args, out result);
383412 }
···391420 /// <returns>Contains the value returned by the indirect call. In case the call does not have a return value, a PValue containing null is returned.</returns>
392421 /// <exception cref = "InvalidCallException">Thrown if the call is not successful.</exception>
393422 [DebuggerStepThrough]
423423+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
424424+ {
425425+ return Type.IndirectCall(sctx, this, args);
426426+ }
427427+428428+ [Obsolete("Use the overload with ReadOnlySpan<PValue> instead.")]
394429 public PValue IndirectCall(StackContext sctx, PValue[] args)
395430 {
396431 return Type.IndirectCall(sctx, this, args);
···13951430 {
13961431 if (Type == PType.String)
13971432 return (string) Value!;
13981398- else if (TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, nameof(ToString), out var text))
14331433+ else if (TryDynamicCall(sctx, [], PCall.Get, nameof(ToString), out var text))
13991434 return text.Value!.ToString()!;
14001435 else
14011436 return ToString();
···16341669 #region IObject Members
1635167016361671 bool IObject.TryDynamicCall(
16371637- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
16721672+ StackContext sctx,
16731673+ ReadOnlySpan<PValue> args,
16741674+ PCall call,
16751675+ string id,
16761676+ [NotNullWhen(true)]
16771677+ out PValue? result
16781678+ )
16381679 {
16391680 if (Engine.StringsAreEqual(id, "self"))
16401681 result = this;
···17101751 {
17111752 result = null;
1712175317131713- if (_tryParseCall(args ?? Array.Empty<object?>(), out var sctx, out var icargs))
17541754+ if (_tryParseCall(args ?? [], out var sctx, out var icargs))
17141755 result = IndirectCall(sctx, icargs);
1715175617161757 return result != null || base.TryInvoke(binder, args, out result);
···17211762 {
17221763 result = null;
1723176417241724- if (_tryParseCall(args ?? Array.Empty<object?>(), out var sctx, out var icargs) &&
17251725- TryDynamicCall(sctx, icargs, PCall.Get, binder.Name, out var pvresult))
17651765+ if (_tryParseCall(args ?? [], out var sctx, out var icargs) &&
17661766+ TryDynamicCall(sctx, icargs.AsSpan(), PCall.Get, binder.Name, out var pvresult))
17261767 result = pvresult;
1727176817281769 return result != null || base.TryInvokeMember(binder, args, out result);
···17331774 result = null;
1734177517351776 if (_tryParseCall(indexes, out var sctx, out var icargs) &&
17361736- TryDynamicCall(sctx, icargs, PCall.Get, string.Empty, out var pvresult))
17771777+ TryDynamicCall(sctx, icargs.AsSpan(), PCall.Get, string.Empty, out var pvresult))
17371778 {
17381779 result = pvresult;
17391780 }
···17481789 args[^1] = value;
1749179017501791 return _tryParseCall(args, out var sctx, out var icargs) &&
17511751- TryDynamicCall(sctx, icargs, PCall.Set, string.Empty, out _)
17921792+ TryDynamicCall(sctx, icargs.AsSpan(), PCall.Set, string.Empty, out _)
17521793 || base.TrySetIndex(binder, indexes, value);
17531794 }
17541795
+2-2
Prexonite/PValueComparer.cs
···3636 return 1;
3737 else
3838 {
3939- if (x.TryDynamicCall(_sctx, Array.Empty<PValue>(), PCall.Get, "CompareTo", out var pr))
3939+ if (x.TryDynamicCall(_sctx, [], PCall.Get, "CompareTo", out var pr))
4040 {
4141 if (pr.Type is not IntPType)
4242 pr.ConvertTo(_sctx, PType.Int);
4343 return (int) pr.Value!;
4444 }
4545- else if (y.TryDynamicCall(_sctx, Array.Empty<PValue>(), PCall.Get, "CompareTo", out pr))
4545+ else if (y.TryDynamicCall(_sctx, [], PCall.Get, "CompareTo", out pr))
4646 {
4747 if (pr.Type is not IntPType)
4848 pr.ConvertTo(_sctx, PType.Int);
+1-1
Prexonite/PVariable.cs
···141141 /// Otherwise, the first element of <paramref name = "args" /> is assigned to the variable.
142142 /// </remarks>
143143 /// <returns>Always the variable's (new) value.</returns>
144144- public PValue IndirectCall(StackContext sctx, PValue[] args)
144144+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
145145 {
146146 if (args.Length != 0)
147147 _value = args[^1];
···80808181 #endregion
82828383- public override bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
8383+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
8484 {
8585 if (args.Length < 1)
8686 {
···9696 public override bool TryDynamicCall(
9797 StackContext sctx,
9898 PValue subject,
9999- PValue[] args,
9999+ ReadOnlySpan<PValue> args,
100100 PCall call,
101101 string id,
102102- [NotNullWhen(true)] out PValue? result
102102+ [NotNullWhen(true)]
103103+ out PValue? result
103104 )
104105 {
105106 if (sctx == null)
···141142 }
142143143144 public override bool TryStaticCall(
144144- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
145145+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
145146 {
146147 //Try CLR static call
147148 var clrint = Object[typeof (int)];
+26-10
Prexonite/Types/ListPType.cs
···2626#region
27272828using System.Collections;
2929+using System.Collections.Immutable;
2930using System.Collections.ObjectModel;
3031using System.Reflection;
3132using System.Text;
···7273 public override bool TryDynamicCall(
7374 StackContext sctx,
7475 PValue subject,
7575- PValue[] args,
7676+ ReadOnlySpan<PValue> args,
7677 PCall call,
7778 string id,
7878- [NotNullWhen(true)] out PValue? result
7979+ [NotNullWhen(true)]
8080+ out PValue? result
7981 )
8082 {
8183 result = null;
···246248 }
247249 //else
248250 //Comparison using lambda expressions
251251+ var allocatedArgs = args.ToImmutableArray();
249252 lst.Sort(
250250- delegate(PValue a, PValue b)
253253+ (a, b) =>
251254 {
252252- foreach (var f in args)
255255+ foreach (var f in allocatedArgs)
253256 {
254254- var pdec = f.IndirectCall(sctx, new[] { a, b });
257257+ var pdec = f.IndirectCall(sctx, a, b);
255258 if (pdec.Type is not IntPType)
256259 pdec = pdec.ConvertTo(sctx, Int);
257260 var dec = (int)pdec.Value!;
258261 if (dec != 0)
259262 return dec;
260263 }
264264+261265 return 0;
262266 });
263267 result = Null.CreatePValue();
···331335 }
332336333337 public override bool TryStaticCall(
334334- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
338338+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
335339 {
336340 result = null;
337341338342 if (Engine.StringsAreEqual(id, "Create"))
339343 {
340340- result = new(new List<PValue>(args), this);
344344+ var buf = new List<PValue>(args.Length);
345345+ foreach (var arg in args)
346346+ {
347347+ buf.Add(arg);
348348+ }
349349+350350+ result = new(buf, this);
341351 }
342352 else if (Engine.StringsAreEqual(id, "CreateFromSize") && args.Length >= 1)
343353 {
···364374 return result != null;
365375 }
366376367367- public override bool TryConstruct(StackContext sctx, PValue[] args, out PValue result)
377377+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, out PValue result)
368378 {
369369- result = new(new List<PValue>(args), this);
379379+ var buf = new List<PValue>(args.Length);
380380+ foreach (var arg in args)
381381+ {
382382+ buf.Add(arg);
383383+ }
384384+385385+ result = new(buf, this);
370386 return true;
371387 }
372388···490506 }
491507492508 public override bool IndirectCall(
493493- StackContext sctx, PValue subject, PValue[] args, out PValue result)
509509+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, out PValue result)
494510 {
495511 var lst = new List<PValue>();
496512 result = List.CreatePValue(lst);
+6-5
Prexonite/Types/NullPType.cs
···9292 return Null.CreatePValue();
9393 }
94949595- public override bool TryConstruct(StackContext sctx, PValue[] args, out PValue result)
9595+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, out PValue result)
9696 {
9797 result = Null.CreatePValue();
9898 return true;
···102102 public override bool TryDynamicCall(
103103 StackContext sctx,
104104 PValue subject,
105105- PValue[] args,
105105+ ReadOnlySpan<PValue> args,
106106 PCall call,
107107 string id,
108108- [NotNullWhen(true)] out PValue? result
108108+ [NotNullWhen(true)]
109109+ out PValue? result
109110 )
110111 {
111112 result = null;
···119120 }
120121121122 public override bool TryStaticCall(
122122- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
123123+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
123124 {
124125 result = null;
125126 return false;
···383384 /// <returns>Always true (doing nothing can't possibly fail...)</returns>
384385 [DebuggerStepThrough]
385386 public override bool IndirectCall(
386386- StackContext sctx, PValue subject, PValue[] args, out PValue result)
387387+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, out PValue result)
387388 {
388389 //Does nothing
389390 result = CreatePValue();
+33-27
Prexonite/Types/ObjectPType.cs
···150150 public override bool TryDynamicCall(
151151 StackContext sctx,
152152 PValue subject,
153153- PValue[] args,
153153+ ReadOnlySpan<PValue> args,
154154 PCall call,
155155 string id,
156156- [NotNullWhen(true)] out PValue? result
156156+ [NotNullWhen(true)]
157157+ out PValue? result
157158 )
158159 {
159160 return tryDynamicCall(sctx, subject, args, call, id, out result, out var dummy);
···162163 bool tryDynamicCall(
163164 StackContext sctx,
164165 PValue subject,
165165- PValue[] args,
166166+ ReadOnlySpan<PValue> args,
166167 PCall call,
167168 string id,
168169 [NotNullWhen(true)] out PValue? result,
···175176 internal bool TryDynamicCall(
176177 StackContext sctx,
177178 PValue subject,
178178- PValue[] args,
179179+ ReadOnlySpan<PValue> args,
179180 PCall call,
180181 string? id,
181182 [NotNullWhen(true)] out PValue? result,
···218219 return true;
219220 }
220221221221- var cond = new CallConditions(sctx, args, call, id);
222222+ var cond = new CallConditions(sctx, args.ToImmutableArray().AsMemory(), call, id);
222223 MemberTypes mtypes;
223224 MemberFilter filter;
224225 if (id.Length != 0)
···242243 ClrType.FindMembers(
243244 MemberTypes.Method,
244245 BindingFlags.Public | BindingFlags.Instance,
245245- Type.FilterName,
246246+ Type.FilterNameIgnoreCase,
246247 cond.Call == PCall.Get ? "GetValue" : "SetValue"));
247248 cond.MemberRestriction.AddRange(
248249 ClrType.FindMembers(
249250 MemberTypes.Method,
250251 BindingFlags.Public | BindingFlags.Instance,
251251- Type.FilterName,
252252+ Type.FilterNameIgnoreCase,
252253 cond.Call == PCall.Get ? "Get" : "Set"));
253254 }
254255 }
···275276276277 public override bool TryStaticCall(
277278 StackContext sctx,
278278- PValue[] args,
279279+ ReadOnlySpan<PValue> args,
279280 PCall call,
280281 string id,
281282 [NotNullWhen(true)] out PValue? result)
···285286286287 bool tryStaticCall(
287288 StackContext sctx,
288288- PValue[] args,
289289+ ReadOnlySpan<PValue> args,
289290 PCall call,
290291 string id,
291292 [NotNullWhen(true)] out PValue? result,
···297298 result = null;
298299 resolvedMember = null;
299300300300- var cond = new CallConditions(sctx, args, call, id);
301301+ var cond = new CallConditions(sctx, args.ToImmutableArray().AsMemory(), call, id);
301302 MemberTypes mtypes;
302303 MemberFilter filter;
303304 if (id.Length != 0)
···492493 case MemberTypes.Method:
493494 var method = (MethodBase) candidate;
494495 var parameters = method.GetParameters();
495495- var cargs = new object[parameters.Length];
496496 //The Sctx hack needs to modify the supplied arguments, so we need a copy of the original reference
497497 var sargs = cond.Args;
498498 var numUpcasts = 0;
499499 var numConversions = 0;
500500501501 var sctxHackOffset = _sctx_hack(parameters, cond) ? 1 : 0;
502502- for (var i = 0; i < cargs.Length && i + sctxHackOffset < parameters.Length; i++)
502502+ for (var i = 0; i < parameters.Length && i + sctxHackOffset < parameters.Length; i++)
503503 {
504504- var arg = sargs[i];
504504+ var arg = sargs.Span[i];
505505 if (arg.IsNull)
506506 {
507507 // null matches anything without penalty
···553553 if (_sctx_hack(parameters, cond))
554554 {
555555 //Add cond.Sctx to the array of arguments
556556- sargs = new PValue[sargs.Length + 1];
557557- Array.Copy(cond.Args, 0, sargs, 1, cond.Args.Length);
558558- sargs[0] = Object.CreatePValue(cond.Sctx);
556556+ var a = new PValue[sargs.Length + 1];
557557+ cond.Args.Span.CopyTo(a.AsSpan(1, cond.Args.Length));
558558+ a[0] = Object.CreatePValue(cond.Sctx);
559559+ sargs = new(a);
559560 }
560561561562 for (var i = 0; i < cargs.Length; i++)
562563 {
563563- var arg = sargs[i];
564564+ var arg = sargs.Span[i];
564565 if (!arg.IsNull) //Neither Type-locked nor null
565566 {
566567 var pTy = parameters[i].ParameterType;
···604605 result = field.GetValue(subject?.Value);
605606 else
606607 {
607607- var arg = cond.Args[0];
608608+ var arg = cond.Args.Span[0];
608609 if (!(arg.IsNull)) //Neither Type-locked nor null
609610 {
610611 var paramTy = field.FieldType;
···706707 class CallConditions
707708 {
708709 public readonly StackContext Sctx;
709709- public readonly PValue[] Args;
710710+ public readonly ReadOnlyMemory<PValue> Args;
710711 public readonly PCall Call;
711712 public readonly string Id;
712713 public bool IgnoreId;
···714715 public Type? ReturnType;
715716 public List<MemberInfo>? MemberRestriction;
716717717717- public CallConditions(StackContext sctx, PValue[]? args, PCall call, string id)
718718+ public CallConditions(StackContext sctx, ReadOnlyMemory<PValue> args, PCall call, string id)
718719 {
719720 Sctx = sctx ?? throw new ArgumentNullException(nameof(sctx));
720720- Args = args ?? Array.Empty<PValue>();
721721+ Args = args;
721722 Call = call;
722723 Id = id;
723724 Directive = null;
···864865 }
865866866867 public override bool IndirectCall(
867867- StackContext sctx, PValue subject, PValue[] args, [NotNullWhen(true)] out PValue? result)
868868+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
868869 {
869870 result = null;
870871 if (subject.Value is IIndirectCall icall)
···880881 PValue dynamicCall(
881882 StackContext sctx,
882883 PValue subject,
883883- PValue[] args,
884884+ ReadOnlySpan<PValue> args,
884885 PCall call,
885886 string id,
886887 out MemberInfo? resolvedMember)
···907908 }
908909909910 public override PValue DynamicCall(
910910- StackContext sctx, PValue subject, PValue[] args, PCall call, string id)
911911+ StackContext sctx,
912912+ PValue subject,
913913+ ReadOnlySpan<PValue> args,
914914+ PCall call,
915915+ string id
916916+ )
911917 {
912918 return dynamicCall(sctx, subject, args, call, id, out var dummy);
913919 }
···941947 return StaticCall(sctx, args, call, id, out var dummy);
942948 }
943949944944- public override bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
950950+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
945951 {
946952 return tryConstruct(sctx, args, out result);
947953 }
948954949955 bool tryConstruct(
950950- StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
956956+ StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
951957 {
952952- var cond = new CallConditions(sctx, args, PCall.Get, "")
958958+ var cond = new CallConditions(sctx, args.ToImmutableArray().AsMemory(), PCall.Get, "")
953959 {
954960 IgnoreId = true,
955961 };
+30-12
Prexonite/Types/PType.cs
···364364 public abstract bool TryDynamicCall(
365365 StackContext sctx,
366366 PValue subject,
367367- PValue[] args,
367367+ ReadOnlySpan<PValue> args,
368368 PCall call,
369369 string id,
370370- [NotNullWhen(true)] out PValue? result
370370+ [NotNullWhen(true)]
371371+ out PValue? result
371372 );
372373373374 public abstract bool TryStaticCall(
374374- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result);
375375+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result);
376376+ // TODO overload with PValue[] args
375377376376- public abstract bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result);
378378+ public abstract bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result);
379379+ // TODO overload with PValue[] args
377380378381 [DebuggerStepThrough]
379382 public virtual PValue Construct(StackContext sctx, PValue[] args)
···401404 #region Indirect Call
402405403406 public virtual bool IndirectCall(
404404- StackContext sctx, PValue subject, PValue[] args, [NotNullWhen(true)] out PValue? result)
407407+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
405408 {
406409 result = null;
407410 return false;
408411 }
409412410410- public PValue IndirectCall(StackContext sctx, PValue subject, PValue[] args)
413413+ public bool IndirectCall(
414414+ StackContext sctx, PValue subject, PValue[] args, [NotNullWhen(true)] out PValue? result)
415415+ {
416416+ return IndirectCall(sctx, subject, new ReadOnlySpan<PValue>(args), out result);
417417+ }
418418+419419+ public PValue IndirectCall(StackContext sctx, PValue subject, ReadOnlySpan<PValue> args)
411420 {
412421 if (IndirectCall(sctx, subject, args, out var ret))
413422 return ret;
···773782 #endregion //Operators
774783775784 public virtual PValue DynamicCall(
776776- StackContext sctx, PValue subject, PValue[] args, PCall call, string id)
785785+ StackContext sctx,
786786+ PValue subject,
787787+ ReadOnlySpan<PValue> args,
788788+ PCall call,
789789+ string id
790790+ )
777791 {
778792 if (TryDynamicCall(sctx, subject, args, call, id, out var result))
779793 return result;
···12591273 }
126012741261127512621262- bool IObject.TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id,
12631263- [NotNullWhen(true)] out PValue? result)
12761276+ bool IObject.TryDynamicCall(
12771277+ StackContext sctx,
12781278+ ReadOnlySpan<PValue> args,
12791279+ PCall call,
12801280+ string id,
12811281+ [NotNullWhen(true)]
12821282+ out PValue? result
12831283+ )
12641284 {
12651285 result = null;
12661286···12731293 else if (Engine.StringsAreEqual(id, StaticCallFromStackId))
12741294 {
12751295 //Try perform static call using the first arguments as the member id.
12761276- var actualArgs = new PValue[args.Length - 1];
12771277- Array.Copy(args, 1, actualArgs, 0, actualArgs.Length);
12781296 var actualId = args[0].CallToString(sctx);
12791279- if (!TryStaticCall(sctx, actualArgs, call, actualId, out result))
12971297+ if (!TryStaticCall(sctx, args[1..], call, actualId, out result))
12801298 result = null;
12811299 }
12821300
+7-1
Prexonite/Types/PValueEnumerator.cs
···8383 /// Since none of the instance members take any arguments, <paramref name = "args" /> must have length 0.
8484 /// </remarks>
8585 public bool TryDynamicCall(
8686- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
8686+ StackContext sctx,
8787+ ReadOnlySpan<PValue> args,
8888+ PCall call,
8989+ string id,
9090+ [NotNullWhen(true)]
9191+ out PValue? result
9292+ )
8793 {
8894 result = null;
8995 if (args == null)
+7-3
Prexonite/Types/PValueKeyValuePair.cs
···8686 /// </remarks>
8787 /// <exception cref = "ArgumentNullException"><paramref name = "sctx" /> is null.</exception>
8888 public bool TryDynamicCall(
8989- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
8989+ StackContext sctx,
9090+ ReadOnlySpan<PValue> args,
9191+ PCall call,
9292+ string id,
9393+ [NotNullWhen(true)]
9494+ out PValue? result
9595+ )
9096 {
9197 if (sctx == null)
9298 throw new ArgumentNullException(nameof(sctx));
9393- if (args == null)
9494- throw new ArgumentNullException(nameof(args));
9599 if (id == null)
96100 throw new ArgumentNullException(nameof(id));
97101
+5-4
Prexonite/Types/RealPType.cs
···66666767 #region Access interface implementation
68686969- public override bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
6969+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
7070 {
7171 if (args.Length <= 1)
7272 {
···7979 public override bool TryDynamicCall(
8080 StackContext sctx,
8181 PValue subject,
8282- PValue[] args,
8282+ ReadOnlySpan<PValue> args,
8383 PCall call,
8484 string id,
8585- [NotNullWhen(true)] out PValue? result
8585+ [NotNullWhen(true)]
8686+ out PValue? result
8687 )
8788 {
8889 if (Engine.StringsAreEqual(id, nameof(ToString)) && args.Length == 0)
···9596 }
96979798 public override bool TryStaticCall(
9898- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
9999+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
99100 {
100101 Object[typeof (double)].TryStaticCall(sctx, args, call, id, out result);
101102
+8-7
Prexonite/Types/StringPType.cs
···393393394394 #endregion
395395396396- public override bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
396396+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
397397 {
398398 result = null;
399399 if (args.Length <= 0)
···408408 public override bool TryDynamicCall(
409409 StackContext sctx,
410410 PValue subject,
411411- PValue[] args,
411411+ ReadOnlySpan<PValue> args,
412412 PCall call,
413413 string id,
414414- [NotNullWhen(true)] out PValue? result
414414+ [NotNullWhen(true)]
415415+ out PValue? result
415416 )
416417 {
417418 result = null;
···552553553554 static void _resolve_params(
554555 StackContext sctx,
555555- IEnumerable<PValue> args,
556556+ ReadOnlySpan<PValue> args,
556557 ref bool isParams,
557558 ICollection<char> sch,
558559 ref List<string>? sst,
···606607 }
607608608609 public override bool TryStaticCall(
609609- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
610610+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
610611 {
611612 if (args.Length >= 1 && Engine.StringsAreEqual(id, "unescape"))
612613 {
···631632 }
632633633634 public override bool IndirectCall(
634634- StackContext sctx, PValue subject, PValue[] args, [NotNullWhen(true)] out PValue? result)
635635+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
635636 {
636637 result = null;
637638 var str = (string) subject.Value!;
···639640 var eng = sctx.ParentEngine;
640641 if (app.Functions.TryGetValue(str, out var func))
641642 {
642642- var fctx = func.CreateFunctionContext(sctx, args);
643643+ var fctx = func.CreateFunctionContext(sctx, args.ToArray());
643644 result = eng.Process(fctx);
644645 }
645646 else if (eng.Commands.TryGetValue(str, out var cmd))
+12-11
Prexonite/Types/StructurePType.cs
···9191 {
9292 }
93939494- public PValue Invoke(StackContext sctx, PValue[] args, PCall call)
9494+ public PValue Invoke(StackContext sctx, ReadOnlySpan<PValue> args, PCall call)
9595 {
9696 if (IsReference)
9797 return Value.IndirectCall(sctx, args);
···102102103103 #region IIndirectCall Members
104104105105- public PValue IndirectCall(StackContext sctx, PValue[] args)
105105+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
106106 {
107107 if (IsReference)
108108 return Value.IndirectCall(sctx, args);
···124124125125 #region PType implementation
126126127127- internal static PValue[] _AddThis(PValue subject, PValue[] args)
127127+ internal static PValue[] _AddThis(PValue subject, ReadOnlySpan<PValue> args)
128128 {
129129 var argst = new PValue[args.Length + 1];
130130 argst[0] = subject;
131131- Array.Copy(args, 0, argst, 1, args.Length);
131131+ args.CopyTo(argst.AsSpan(1, args.Length));
132132 return argst;
133133 }
134134···144144 public override bool TryDynamicCall(
145145 StackContext sctx,
146146 PValue subject,
147147- PValue[] args,
147147+ ReadOnlySpan<PValue> args,
148148 PCall call,
149149 string id,
150150- [NotNullWhen(true)] out PValue? result
150150+ [NotNullWhen(true)]
151151+ out PValue? result
151152 )
152153 {
153154 result = null;
···204205 }
205206206207 public override bool TryStaticCall(
207207- StackContext sctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
208208+ StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
208209 {
209210 result = null;
210211 return false;
···361362 /// <param name = "args">An array of arguments. Ignored in the current implementation.</param>
362363 /// <param name = "result">The out parameter that holds the resulting PValue.</param>
363364 /// <returns>True if the construction was successful; false otherwise.</returns>
364364- public override bool TryConstruct(StackContext sctx, PValue[] args, [NotNullWhen(true)] out PValue? result)
365365+ public override bool TryConstruct(StackContext sctx, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
365366 {
366367 result = new(new SymbolTable<Member>(), this);
367368 return true;
···412413 }
413414414415 public override bool IndirectCall(
415415- StackContext sctx, PValue subject, PValue[] args, [NotNullWhen(true)] out PValue? result)
416416+ StackContext sctx, PValue subject, ReadOnlySpan<PValue> args, [NotNullWhen(true)] out PValue? result)
416417 {
417418 result = null;
418419 if (subject.Value is not SymbolTable<Member> obj)
···461462 return CompilationFlags.PrefersCustomImplementation;
462463 }
463464464464- static readonly MethodInfo GetStructurePType =
465465+ static readonly MethodInfo _getStructurePType =
465466 typeof (PType).GetProperty(nameof(Structure))!.GetGetMethod()!;
466467467468 /// <summary>
···471472 /// <param name = "ins">The instruction to compile.</param>
472473 void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins)
473474 {
474474- state.EmitCall(GetStructurePType);
475475+ state.EmitCall(_getStructurePType);
475476 }
476477477478 #endregion
···116116 "Test case run function (part of testing framework) not found. Was looking for {0}.", RunTestId);
117117 if (rt == null) throw new InvalidOperationException("rt is null");
118118119119- var resP = rt.Run(Engine, new[] {PType.Null, Root.CreateNativePValue(tc)});
119119+ var resP = rt.Run(Engine, [PType.Null, Root.CreateNativePValue(tc)]);
120120 var success = (bool) resP.DynamicCall(Root, Array.Empty<PValue>(), PCall.Get, "Key").Value!;
121121 if (success)
122122 return;
···9191 {
929293939494- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id, out PValue result)
9494+ public bool TryDynamicCall(
9595+ StackContext sctx,
9696+ ReadOnlySpan<PValue> args,
9797+ PCall call,
9898+ string id,
9999+ out PValue? result
100100+ )
95101 {
96102 result = PType.Null;
97103 (string Id, Application ParentApplication) testCase;
···104110 return true;
105111 case "SUCCESS":
106112 testCase = extract(sctx,
107107- args[0].TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "test", out var testCaseValue)
113113+ args[0].TryDynamicCall(sctx, [], PCall.Get, "test", out var testCaseValue)
108114 ? testCaseValue
109115 : throw new PrexoniteException("Expected test result to have a member called `test`."));
110116 Trace.WriteLine($"test [{sctx.ParentApplication.Module.Name}].{testCase.Id} successful");
111117 return true;
112118 case "FAILURE":
113119 testCase = extract(sctx,
114114- args[0].TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "test", out testCaseValue)
120120+ args[0].TryDynamicCall(sctx, [], PCall.Get, "test", out testCaseValue)
115121 ? testCaseValue
116122 : throw new PrexoniteException("Expected test result to have a member called `test`."));
117123 var exceptionObj =
118118- args[0].TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "e", out var exceptionValue)
124124+ args[0].TryDynamicCall(sctx, [], PCall.Get, "e", out var exceptionValue)
119125 ? exceptionValue.Value
120126 : throw new PrexoniteException(
121127 "Expected failed test result to have a member called `e`");
···163169164170 // WHEN
165171 // result~(Bool:Structure)
166166- var result = TestSuiteRunFunction.Run(TestSuiteEngine, new[] {ui, testCaseValue});
172172+ var result = TestSuiteRunFunction.Run(TestSuiteEngine, [ui, testCaseValue]);
167173168174 // THEN
169175 // (the UI callback should actually raise an exception in case of a test error)
170170- var ctx = new NullContext(TestSuiteEngine, TestSuiteApplication, Enumerable.Empty<string>());
171171- Assert.IsTrue(result.TryDynamicCall(ctx, Array.Empty<PValue>(), PCall.Get, "Key", out var successfulValue),
176176+ var ctx = new NullContext(TestSuiteEngine, TestSuiteApplication, []);
177177+ Assert.IsTrue(result.TryDynamicCall(ctx, [], PCall.Get, "Key", out var successfulValue),
172178 "Expected result of test run function on [{1}].{2} to have a `Key` member. Got: {0}", result,
173179 TestSuiteApplication.Module.Name, testCaseName);
174180 Assert.AreEqual(true, successfulValue!.Value, "Expected test [{0}].{1} to be successful.",
+8-2
PrexoniteTests/Tests/MemberCallable.cs
···2424// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
2525// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26262727+using System;
2728using System.Diagnostics;
2829using NUnit.Framework;
2930using Prexonite;
···47484849 #region Implementation of IObject
49505050- public bool TryDynamicCall(StackContext sctx, PValue[] args, PCall call, string id,
5151- out PValue result)
5151+ public bool TryDynamicCall(
5252+ StackContext sctx,
5353+ ReadOnlySpan<PValue> args,
5454+ PCall call,
5555+ string id,
5656+ out PValue? result
5757+ )
5258 {
5359 Assert.IsTrue(Expectations.TryGetValue(id, out var expectation),
5460 $"A call to member {id} on object {Name} is not expected.");
···2424// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
2525// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26262727+using System;
2728using System.Collections.Generic;
2829using System.IO;
2930using System.Linq;
···1648164916491650 public Dictionary<string, string> VirtualFiles { get; } = new();
1650165116511651- public override PValue Run(StackContext sctx, PValue[] args)
16521652+ public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args)
16521653 {
16531654 var n = args[0].CallToString(sctx);
16541655 var virtualFile = VirtualFiles[n];
+2-2
PrexoniteTests/Tests/TypeSystem.cs
···178178179179 var escaped = PType.String.CreatePValue(sEscaped);
180180 Assert.IsTrue(
181181- escaped.TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "unescape", out var unescaped));
181181+ escaped.TryDynamicCall(sctx, [], PCall.Get, "unescape", out var unescaped));
182182 Assert.AreEqual(sUnescaped, unescaped!.Value as string);
183183 Assert.IsTrue(
184184- unescaped.TryDynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "escape", out escaped));
184184+ unescaped.TryDynamicCall(sctx, [], PCall.Get, "escape", out escaped));
185185 Assert.AreEqual(sEscaped, escaped!.Value as string);
186186 }
187187}
+2-2
PrexoniteTests/Tests/VMTests.Basic.cs
···174174 var v0 = rnd.Next(1, 100);
175175 var expected = 2*v0;
176176177177- var result = target.Functions["twice"]!.Run(engine, new PValue[] {v0});
177177+ var result = target.Functions["twice"]!.Run(engine, [v0]);
178178 Assert.AreEqual(
179179 PType.BuiltIn.Int,
180180 result.Type.ToBuiltIn(),
···189189 var y1 = x1 + z;
190190 expected = y1 + x1;
191191192192- result = target.Functions["complicated"]!.Run(engine, new PValue[] {x0, y0});
192192+ result = target.Functions["complicated"]!.Run(engine, [x0, y0]);
193193 Assert.AreEqual(
194194 PType.BuiltIn.Int,
195195 result.Type.ToBuiltIn(),
+21-9
PrexoniteTests/Tests/VMTests.Commands.cs
···321321}
322322");
323323324324- var check = CompilerTarget.CreateFunctionValue((s, _) =>
325325- {
326326- if (s.ParentEngine.Stack.Count > 2)
324324+ var check = new PValue(new ProvidedFunction((s, _) =>
327325 {
328328- foreach (var stackContext in s.ParentEngine.Stack)
329329- TestContext.WriteLine(" - " + stackContext);
326326+ if (s.ParentEngine.Stack.Count > 2)
327327+ {
328328+ foreach (var stackContext in s.ParentEngine.Stack)
329329+ TestContext.WriteLine(" - " + stackContext);
330330331331- throw new PrexoniteException("Stack size is not constant.");
332332- }
333333- return PType.Null;
334334- });
331331+ throw new PrexoniteException("Stack size is not constant.");
332332+ }
333333+334334+ return PType.Null;
335335+ }),
336336+ PType.Object[typeof(IIndirectCall)]);
335337336338 var fac = target.Functions["factorial"];
337339 Assert.IsTrue(fac!.Meta[PFunction.VolatileKey].Switch,
···342344 Expect(1, check, 1);
343345 //Expect(40320,check,8);
344346 }
347347+348348+ class ProvidedFunction(ProvidedFunctionImpl func) : IIndirectCall
349349+ {
350350+ public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args)
351351+ {
352352+ return func(sctx, args);
353353+ }
354354+ }
355355+356356+ delegate PValue ProvidedFunctionImpl(StackContext sctx, ReadOnlySpan<PValue> args);
345357346358 [Test]
347359 public void CallAsyncCommandImplementation()
···190190 return Store(Compile(input));
191191 }
192192193193- protected void Expect<T>(T expectedReturnValue, params PValue[] args)
193193+ protected void Expect<T>(T expectedReturnValue, params ReadOnlySpan<PValue> args)
194194 {
195195 ExpectReturnValue(target.Meta[Application.EntryKey], expectedReturnValue, args);
196196 }
197197198198- protected void Expect(Action<PValue> assertion, params PValue[] args)
198198+ protected void Expect(Action<PValue> assertion, params ReadOnlySpan<PValue> args)
199199 {
200200 ExpectReturnValue(target.Meta[Application.EntryKey], assertion, args);
201201 }
202202203203- protected void ExpectNamed<T>(string functionId, T expectedReturnValue, params PValue[] args)
203203+ protected void ExpectNamed<T>(string functionId, T expectedReturnValue, params ReadOnlySpan<PValue> args)
204204 {
205205 ExpectReturnValue(functionId, expectedReturnValue, args);
206206 }
207207208208- protected void ExpectReturnValue<T>(string functionId, T expectedReturnValue, PValue[] args)
208208+ protected void ExpectReturnValue<T>(string functionId, T expectedReturnValue, ReadOnlySpan<PValue> args)
209209 {
210210 ExpectReturnValue(functionId, rv =>
211211 {
···214214 }, args);
215215 }
216216217217- protected void ExpectReturnValue(string functionId, Action<PValue> assertion, PValue[] args)
217217+ protected void ExpectReturnValue(string functionId, Action<PValue> assertion, ReadOnlySpan<PValue> args)
218218 {
219219 if (assertion == null)
220220 throw new ArgumentNullException(nameof(assertion));
221221-222222- if (args.Any(value => (PValue?)value == null))
223223- throw new ArgumentException(
224224- "Arguments must not contain naked CLR null references. Use `PType.Null`.");
221221+222222+ foreach (var value in args)
223223+ {
224224+ if ((PValue?)value == null) throw new ArgumentException("Arguments must not contain naked CLR null references. Use `PType.Null`.");
225225+ }
225226226227 if (!target.Functions.Contains(functionId))
227228 throw new PrexoniteException("Function " + functionId + " cannot be found.");
+7-2
Prx/Benchmarking/Benchmark.cs
···128128 #region IObject Members
129129130130 public bool TryDynamicCall(
131131- StackContext sctx, PValue[]? args, PCall call, string? id, [NotNullWhen(true)] out PValue? result)
131131+ StackContext sctx,
132132+ ReadOnlySpan<PValue> args,
133133+ PCall call,
134134+ string id,
135135+ [NotNullWhen(true)]
136136+ out PValue? result
137137+ )
132138 {
133139 if (sctx == null)
134140 throw new ArgumentNullException(nameof(sctx));
135135- args ??= Array.Empty<PValue>();
136141 id ??= "";
137142138143 result = null;
+1-2
Prx/Benchmarking/BenchmarkEntry.cs
···126126 Console.WriteLine("\tIterations:\t{0}", iterations);
127127 }
128128129129- var argv = new PValue[] {iterations};
130129 sw.Reset();
131130 sw.Start();
132132- Function.Run(Parent.Machine, argv);
131131+ Function.Run(Parent.Machine, [iterations]);
133132 sw.Stop();
134133135134 var raw = sw.ElapsedMilliseconds;
+9-3
Prx/PrexoniteConsole.cs
···6464 Resources.PrexoniteConsole_OnTab_RequiresSctx);
6565 if (Tab is { IsNull: false })
6666 {
6767- var plst = Tab.IndirectCall(callingSctx, new PValue[] {pref, root});
6767+ var plst = Tab.IndirectCall(callingSctx, pref, root);
6868 plst.ConvertTo(callingSctx, PType.Object[typeof (IEnumerable)], true);
6969 foreach (var o in (IEnumerable) plst.Value!)
7070 {
···8181 /// <param name = "callingSctx">The stack context in which the command is executed.</param>
8282 /// <param name = "args">The array of arguments supplied to the command.</param>
8383 /// <returns>A reference to the prexonite console.</returns>
8484- public PValue Run(StackContext callingSctx, PValue[] args)
8484+ public PValue Run(StackContext callingSctx, ReadOnlySpan<PValue> args)
8585 {
8686 return callingSctx.CreateNativePValue(this);
8787 }
···9898 StackContext? sctx;
9999100100 public bool TryDynamicCall(
101101- StackContext callingSctx, PValue[] args, PCall call, string id, [NotNullWhen(true)] out PValue? result)
101101+ StackContext callingSctx,
102102+ ReadOnlySpan<PValue> args,
103103+ PCall call,
104104+ string id,
105105+ [NotNullWhen(true)]
106106+ out PValue? result
107107+ )
102108 {
103109 result = null;
104110
+69-69
Prx/Properties/Resources.Designer.cs
···11-//------------------------------------------------------------------------------
22-// <auto-generated>
33-// This code was generated by a tool.
44-//
55-// Changes to this file may cause incorrect behavior and will be lost if
66-// the code is regenerated.
77-// </auto-generated>
88-//------------------------------------------------------------------------------
99-1010-namespace Prx.Properties {
1111- using System;
1212-1313-1414- /// <summary>
1515- /// A strongly-typed resource class, for looking up localized strings, etc.
1616- /// This class was generated by MSBuild using the GenerateResource task.
1717- /// To add or remove a member, edit your .resx file then rerun MSBuild.
1818- /// </summary>
1919- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Build.Tasks.StronglyTypedResourceBuilder", "15.1.0.0")]
2020- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
2121- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
2222- internal class Resources {
2323-2424- private static global::System.Resources.ResourceManager resourceMan;
2525-2626- private static global::System.Globalization.CultureInfo resourceCulture;
2727-2828- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
2929- internal Resources() {
3030- }
3131-3232- /// <summary>
3333- /// Returns the cached ResourceManager instance used by this class.
3434- /// </summary>
3535- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
3636- internal static global::System.Resources.ResourceManager ResourceManager {
3737- get {
3838- if (object.ReferenceEquals(resourceMan, null)) {
3939- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Prx.Properties.Resources", typeof(Resources).Assembly);
4040- resourceMan = temp;
4141- }
4242- return resourceMan;
4343- }
4444- }
4545-4646- /// <summary>
4747- /// Overrides the current thread's CurrentUICulture property for all
4848- /// resource lookups using this strongly typed resource class.
4949- /// </summary>
5050- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
5151- internal static global::System.Globalization.CultureInfo Culture {
5252- get {
5353- return resourceCulture;
5454- }
5555- set {
5656- resourceCulture = value;
5757- }
5858- }
5959-6060- /// <summary>
6161- /// Looks up a localized string similar to OnTab must either be called from via the ReadLine method or with a valid stack context..
6262- /// </summary>
6363- internal static string PrexoniteConsole_OnTab_RequiresSctx {
6464- get {
6565- return ResourceManager.GetString("PrexoniteConsole_OnTab_RequiresSctx", resourceCulture);
6666- }
6767- }
6868- }
6969-}
11+//------------------------------------------------------------------------------
22+// <auto-generated>
33+// This code was generated by a tool.
44+//
55+// Changes to this file may cause incorrect behavior and will be lost if
66+// the code is regenerated.
77+// </auto-generated>
88+//------------------------------------------------------------------------------
99+1010+namespace Prx.Properties {
1111+ using System;
1212+1313+1414+ /// <summary>
1515+ /// A strongly-typed resource class, for looking up localized strings, etc.
1616+ /// This class was generated by MSBuild using the GenerateResource task.
1717+ /// To add or remove a member, edit your .resx file then rerun MSBuild.
1818+ /// </summary>
1919+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Build.Tasks.StronglyTypedResourceBuilder", "15.1.0.0")]
2020+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
2121+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
2222+ internal class Resources {
2323+2424+ private static global::System.Resources.ResourceManager resourceMan;
2525+2626+ private static global::System.Globalization.CultureInfo resourceCulture;
2727+2828+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
2929+ internal Resources() {
3030+ }
3131+3232+ /// <summary>
3333+ /// Returns the cached ResourceManager instance used by this class.
3434+ /// </summary>
3535+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
3636+ internal static global::System.Resources.ResourceManager ResourceManager {
3737+ get {
3838+ if (object.ReferenceEquals(resourceMan, null)) {
3939+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Prx.Properties.Resources", typeof(Resources).Assembly);
4040+ resourceMan = temp;
4141+ }
4242+ return resourceMan;
4343+ }
4444+ }
4545+4646+ /// <summary>
4747+ /// Overrides the current thread's CurrentUICulture property for all
4848+ /// resource lookups using this strongly typed resource class.
4949+ /// </summary>
5050+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
5151+ internal static global::System.Globalization.CultureInfo Culture {
5252+ get {
5353+ return resourceCulture;
5454+ }
5555+ set {
5656+ resourceCulture = value;
5757+ }
5858+ }
5959+6060+ /// <summary>
6161+ /// Looks up a localized string similar to OnTab must either be called from via the ReadLine method or with a valid stack context..
6262+ /// </summary>
6363+ internal static string PrexoniteConsole_OnTab_RequiresSctx {
6464+ get {
6565+ return ResourceManager.GetString("PrexoniteConsole_OnTab_RequiresSctx", resourceCulture);
6666+ }
6767+ }
6868+ }
6969+}