{"id":13662463,"url":"https://github.com/pjc0247/SlowSharp","last_synced_at":"2025-04-25T10:31:45.543Z","repository":{"id":37295806,"uuid":"177946277","full_name":"pjc0247/SlowSharp","owner":"pjc0247","description":"C# interpreter written in C#","archived":false,"fork":false,"pushed_at":"2022-12-08T11:05:32.000Z","size":391,"stargazers_count":129,"open_issues_count":6,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-02T05:14:00.507Z","etag":null,"topics":["csharp"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjc0247.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-27T08:01:16.000Z","updated_at":"2024-05-08T01:28:46.000Z","dependencies_parsed_at":"2023-01-25T11:15:58.181Z","dependency_job_id":null,"html_url":"https://github.com/pjc0247/SlowSharp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FSlowSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FSlowSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FSlowSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FSlowSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjc0247","download_url":"https://codeload.github.com/pjc0247/SlowSharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223996682,"owners_count":17238347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp"],"created_at":"2024-08-02T05:01:59.322Z","updated_at":"2024-11-10T18:30:37.340Z","avatar_url":"https://github.com/pjc0247.png","language":"C#","readme":"SlowSharp [![Build Status](https://travis-ci.com/pjc0247/SlowSharp.svg?branch=master)](https://travis-ci.com/pjc0247/SlowSharp)\n====\n\nSlow version of C# interpreter because modern JITs are too fast.\u003cbr\u003e\n[Web Playground](https://pjc0247.github.io/UniScript/uniplayground/)\n\nPros\n----\n* __More Compatability__: Brings C# scripting into __WSA__, __iOS__ and __WebAssembly__.\n* __And nothing__\n\n\nZero-binding\n----\n* No manual assembly references\n* No type or method binding\n\nEven this can be possible:\n```cs\nCScript.Run(@\"\n   CScript.Run(\"\" Console.WriteLine(\"\"hello from inception\"\"); \"\");\n\");\n```\n\nHot Reloading\n----\nCan replace methods after parsing. This also affects already instantiated objects. \n```cs\nvar r = CScript.CreateRunner(@\"\nclass Foo { public int GiveMeNumber() =\u003e 10; }\n\");\n\nvar foo = r.Instantiate(\"Foo\");\n// should be 10\nfoo.Invoke(\"GiveMeNumber\");\n```\n```cs\nss.UpdateMethodsOnly(@\"\nclass Foo { public int GiveMeNumber() =\u003e 20; }\n\");\n// should be 20\nfoo.Invoke(\"GiveMeNumber\");\n```\n\nOverriding (Virtual inheritance)\n----\nSupports virtual inheritance, this is useful with __Unity__.\n```cs\nclass MyBehaviour : MonoBehaviour { \n   public void SayHello() { /* ... */ }\n}\n```\n```cs\n// Error, MonoBehaviour cannot be instantiated by Unity's law\nss.Instantiate(\"MyBehaviour\");\n\n// Use this when you're not able to create an object yourself.\nss.Override(\"MyBehaviour\", gameObject);\n```\n\nFinally, there will be two instances, but act as one derivered object.\n```cs\n// You can invoke methods from `MyBehaviour` which are defined in script-side.\nss.Invoke(\"SayHello\");\n\n// You can also invoke methods from `MonoBehaviour`\nss.Invoke(\"StopAllCoroutines\");\n```\n\nSandboxing\n----\n### Access control\nPrevents malicious function call such as `Threading` and `File`.\n```cs\nvar ac = new AccessControl();\nac.AddBlockedType(\"System.Threading.Thread\");\nac.AddBlockedNamespace(\"System.IO\");\n\nnew RunConfig() {\n  accessControl = ac\n};\n```\n\n### Timeout\nPrevents long-running tasks with a timeout option.\n```cs\nnew RunConfig() {\n  timeout = 1000 /* ms */\n};\n```\n\n\nLimitations\n----\nSince __SlowSharp__ is an interpreter, there're some differences and limitations.\n\n__Lazy semantic validation__\u003cbr\u003e\n__SlowSharp__ does not validate whole syntaxs during the parse time. It only checks the overall form is valid or not.\u003cbr\u003e\nAs a result, some mistakes won't be detected until it's fully reached and executed.\n```cs\nConsole.WriteLine(\"Hello\");\n\n// There's not method `WriteLn` in `Conosle` class.\n// However, this will not throw an exception util SlowSharp actually \n// evaluates the below line.\nConsole.WriteLn(\"World\");\n```\n```cs\nvar a = 1234;\nConsole.WriteLine(a);\nvar a = 4556; // redefination\n```\n","funding_links":[],"categories":["Open Source Packages","Open Source Repositories","C\\#"],"sub_categories":["Scriptings"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjc0247%2FSlowSharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjc0247%2FSlowSharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjc0247%2FSlowSharp/lists"}