SLThree 0.9.0-alpha.580
See the version list below for details.
dotnet add package SLThree --version 0.9.0-alpha.580
NuGet\Install-Package SLThree -Version 0.9.0-alpha.580
<PackageReference Include="SLThree" Version="0.9.0-alpha.580" />
paket add SLThree --version 0.9.0-alpha.580
#r "nuget: SLThree, 0.9.0-alpha.580"
// Install SLThree as a Cake Addin #addin nuget:?package=SLThree&version=0.9.0-alpha.580&prerelease // Install SLThree as a Cake Tool #tool nuget:?package=SLThree&version=0.9.0-alpha.580&prerelease
SLThree
A simple and easily embedded programming language for the .NET platform. Dynamic typing, lightweight reflection, this language is convenient for describing data and behavior.
For more information about syntax: slt-lang.github.io
Embedding
Code example for C#:
using System;
using SLThree;
using SLThree.Embedding;
namespace TestSLThree
{
public class Program
{
public class TC
{
public int x, y;
public Method sum;
public object Sum() => sum.Invoke(x, y);
}
public class TC2
{
public Func<int, int, int> sum2;
}
static void Main(string[] args)
{
//Context.ReturnedValue method
Console.WriteLine(
"return 2 + 2 * 2;"
.RunScript().ReturnedValue
);
//Uwrapping method
var tc = "x = 3; y = 5; sum = (a, b) => a + b;"
.RunScript()
.Unwrap<TC>();
Console.WriteLine(tc.Sum());
//[Experimental] Compilation:
var tc2 = @"(native sum2(i32 x, i32 y): i32 => x + y)
.CreateDelegate(@System.Func<i32, i32, i32>);"
.RunScript()
.Unwrap<TC2>();
Console.WriteLine(tc2.sum2(35, 65));
}
}
}
Download
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.9.0-alpha.700 | 50 | 10/5/2024 | |
0.9.0-alpha.580 | 52 | 9/1/2024 | |
0.9.0-alpha.555 | 82 | 8/18/2024 | |
0.9.0-alpha.484 | 64 | 8/15/2024 | |
0.9.0-alpha.411 | 51 | 8/8/2024 | |
0.9.0-alpha.333 | 42 | 8/4/2024 | |
0.9.0-alpha.308 | 41 | 8/2/2024 | |
0.9.0-alpha.247 | 55 | 7/31/2024 | |
0.9.0-alpha.209 | 42 | 7/31/2024 | |
0.9.0-alpha.186 | 49 | 7/30/2024 | |
0.9.0-alpha.149 | 42 | 7/29/2024 | |
0.9.0-alpha.115 | 51 | 7/28/2024 | |
0.9.0-alpha.68 | 59 | 6/21/2024 | |
0.9.0-alpha.30 | 57 | 6/18/2024 | |
0.8.1 | 119 | 6/22/2024 | |
0.8.0 | 115 | 6/21/2024 | |
0.8.0-rc.112 | 60 | 6/20/2024 | |
0.8.0-rc.45 | 69 | 6/19/2024 | |
0.8.0-rc.0 | 72 | 6/18/2024 | |
0.8.0-beta.0 | 63 | 6/13/2024 | |
0.8.0-alpha.234 | 63 | 6/12/2024 | |
0.8.0-alpha.208 | 76 | 6/9/2024 | |
0.8.0-alpha.112 | 68 | 6/9/2024 | |
0.8.0-alpha.67 | 72 | 6/8/2024 | |
0.8.0-alpha.48 | 63 | 6/8/2024 | |
0.8.0-alpha.10 | 67 | 6/8/2024 | |
0.7.1.2989 | 118 | 6/1/2024 | |
0.7.0.2988 | 146 | 4/24/2024 | |
0.6.0 | 144 | 1/22/2024 | |
0.5.2.1 | 178 | 12/10/2023 |
------ 0.9.0 Massive Update ------ [~.~.~]
Language:
- Template methods
- Add the `template` modificator to generic method
`template f<T>() => T;`
- Constraints on parameters
`template<T1: value + i64 | u64,
T2: => (T2 >= 10)>() => T1 + T2;`
- Constraint expression to describe them in advance
`constraint [Name][ on T]: expr | value`
- Invokation (and making without `()`):
`template f<T>() {
x(a1, a2) => (a1, a2);
return x(T, T as is);
}
f<as value : (2 + 2)>();
f<as expr : (2 + 2)>();
f<as value = (2 + 2)>();`
- Blocks `{...}` is expressions now
- Contextual reference and dereference: `&T`, `*T`
Reference links the expression to the context
Dereferencing executes referenced expression in it
- Defining methods with default parameters
`(x = 5, y = 10) => x + y;`
- `params` modificator:
`params f(args) => args;`
`args(1, 2, 3); //[1, 2, 3]`
- Calling methods with a variable number of arguments
- Accord expression `accord (x, y) { (i64, i64) => true; }`
Syntax sugar for type-matching
- Dictionary initializers new syntax:
`new dict { 1: 2, 3: 4 }`
`new dict<i64, i64> { 1: 2, 3: 4 }`
- Array and list initializers new syntax:
`new array { 1, 2, 3, 4 }`
- Also supports: stack, queue
- Short initializers:
- Array: `new { 1, 2, 3 }`
- Dictionary: `new { 1: 2, 3: 4 }`
- Context without private context: `new {...}`
- Multiline interpolated strings $"""str{2}""";
- Multiline strings """str"""
- Changed match expression arrow `==>` -> `=>`
- Do-while loop
`do {;} while (true);`
- Finite loop
`loop (10) (using console).writeln(i += 1);`
- Infinite loop
`loop (using console).writeln(i += 1);`
- Enumerable-slices `[ [Lower]..[=][Upper] ]`
- New get chooser syntax:
`*[1, 2, 3]` -> `^*[1, 2, 3]`
- Expressions and code initilizers:
`${ return; }`, `$(2 + 2)` like `(2 + 2) as is`
- In-Context invokator operator `->`: `ctx->expression`
- Runtime analog `-->`: `ctx-->$(expression)`
- Syntax for creating methods from generics:
`_is<T>(a) => a is T; isi64 = _is<i64>;`
- Syntax sugar for overloading methods
- Null-coalescing augmented assign operator `??=`
- Now you can define variables in the method from the outside
via 'funcname.inside` and `funcname.defaults` contexts
- Dividing ranges into `..` and `..=` (including last)
- Errors localization
Bugfixes:
- Ignoring deffered code in static (#129)
- Ignoring indexed properties in wrappers (#130)
- Generic supporting for 0.8 initializers (#131)
- Arrays supporting in static typeof (#132)
- Generic cloning policy is now lossless
- Indentation supporting in $-strings (#133)
- Whitespace after comma fix (#135)