This stuff looks interesting. Imagine if we can create dynamic objects based on a JSON Schema and then parse a JSON file with validation. I tried to do something similar to this with plain keyvalue files, before the transitional syntax was announced.
I'm concerned about crashing plugins. Will this also result in memory leaks? Say a plugin creates several objects and then for some reason crashes. Then it can't dispose those objects. I suppose the Dynamic plugin could track which plugin that owns each object and watch if a plugin is unloaded and automatically dispose it.
I was just experimenting with methodmaps myself and did make a simple "class" based on StringMap. This is static objects, but my simple benchmarks shows that it reads a property/key in 70-110 nanoseconds, so it's pretty fast.
Spoiler
PHP Code:
methodmap Person < StringMap {
public Person(char[] name, int level) { StringMap person = new StringMap(); person.SetString("name", name); person.SetValue("level", level); person.SetValue("some_very_long_dummy_key_name_property", 1); PrintToServer("Created person with name '%s' and level %d", name, level);
return view_as<Person>(person); }
public bool getName(char[] buffer, int size) { return this.GetString("name", buffer, size); }
public bool setName(char[] name) { return this.SetString("name", name); }
property int dummyProperty { public get() { int dummy; this.GetValue("some_very_long_dummy_key_name_property", dummy); return dummy; } }
public int getLevel() { int level; this.GetValue("level", level); return level; } };