Since UniScript uses SlowSharp as a backend, there're some differences compared to original C#.
UniScript is designed for creating game flows not a core logic computation, Threading is not a major consideration at this moment.
Current implementation of await
keyword just Waits until task ends and may blocks the execution thread.
Here's a code from SlowSharp.
private HybInstance RunAwait(AwaitExpressionSyntax node) {
var task = RunExpression(node.Expression);
if (task.isCompiledType &&
task.Unwrap() is Task t) {
t.Wait();
return HybInstance.Null();
}
/* ... And goes on */
}
goto
is very unstable for the moment.
For example, every execution of goto
creates a frame. this may lead program to StackOverflowException
or memory leaks.
label:
Console.WriteLine("Hello World");
goto label;
Strongly not recommended to use.
generics are one of hardest part to implement.
Instantiating generic classes from script is working, declaring generic classes or method is not supported yet.
// This is OK
var list = new List<int>();
// Oops, Not implemented yet
class Foo<T> { }
SlowSharp is an interpreter and does not have linking
phase during compliation. partial
keyword won't be supported by design.
partial class Foo {
public void A() { }
}
partial class Foo {
public void B() { }
}
Currently, main purpose of UniScript is writing a game flow using external texts not creating a datastructure.
However, I'm totally agree with this is necessary.
Will be implemented in near future.
Will be implemented with high priority.
Now supports with partially implementation.
pjc0247/SlowSharp#1
- Latest language features such as
pattern matching
andnamed tuple
. - Special keywords:
unsafe
,stackalloc
,volatile
and so on.