[Opensim-users] use of C# in scripts

Ethan Gardener eekee57 at fastmail.fm
Sun Feb 24 10:58:54 UTC 2019


On Sat, Feb 23, 2019, at 8:11 PM, Dr Ramesh Ramloll wrote:
> I think the assumption that C# should work only in closed secure
> environments kind of narrows down the application space by quite a bit,
> like 90% or more.

Yeah.  It narrows it down to about the same space as custom modules, so why not write them instead?

This is one area where I wish OpenSim had branched out a bit; adding other languages, but I guess there was no-one to work on it.  I wasn't up to the task myself, as much as I wished I was.  Making a safe interpreter is non-trivial anyway.  Lately, I've been looking at one of the problems, avoiding memory leaks (which could lead to a denial of service attack or possibly an overflow exploit).  This alone is not at all easy to solve efficiently.  It would be better if modern computers descended from the Lisp Machines of the 1980s, they had hardware support for automatic garbage collection, but instead we have virtual memory schemes which make it hard for garbage collectors to work efficiently.  (I don't think anyone really wants to pay for the extra bits this needs.  The cost of memory was a huge limiting factor through the '80s and much of the '90s, and remains a little bit of a problem today.)

I can solve my problems with a relatively inefficient design, but that would be ridiculous in an environment where a single simulator may have to run thousands of scripts.  I could hypothetically write a full-blown garbage collector, but it's not worth it because such garbage collectors are notoriously prone to bugs, and *still* have efficiency problems.  Garbage collectors are one of those things which exponentially approach infinite complexity as they approach correctness and efficiency.  

Is a simple, efficient design possible?  Yes... if you limit the possible data structures.  ;)  Particularly, never allow complex data types to contain references to other complex data types, that prevents reference loops which are *the* problem requiring complex garbage collectors.  I haven't chosen this for my comparatively inefficient design, I've chosen to make all data structures immutable; if you want to change something, you have to copy the structure.  That way, it's impossible for a structure to contain a reference to itself because the structure becomes immutable before the public reference to it exists.  This very much goes against the grain, I've been exploring every other way of doing it, but I figure if it's good enough for high finance it ought to be good enough for me.  I wonder if it might actually be good enough for OpenSim.  Maybe I'll run some experiments comparing scale, but my system probably won't be ready for that for a long time yet.  My health isn't helping me get on with it.


More information about the Opensim-users mailing list