Host object APIs: Difference between revisions

Jump to navigation Jump to search
(New page: This page describes the current native model in tamarin tracing. Everything works by running the GlobalOptimizer on abc's to be compiled into the host application. Typically there are...)
 
Line 99: Line 99:
# Namespace == Namespacep
# Namespace == Namespacep
# Number == double
# Number == double
# UDT == ScriptObjectp
Having every host class exposed as a ScriptObjectp feels bad.  Currently we're just doing things like:
typedef FooBar ScriptObject;
So that C++ code can use FooBar* instead of ScriptObjectp.  We'd like to make this even more type-safe.  Perhaps something like:
template<const char *TNAME>
class NativeObject
{
    ScriptObjectp obj;
    NativeObject(ScriptObjectp obj) :obj(obj)
    {
        ASSERT_TYPE(obj, TNAME);
    }   
}
typedef NativeObject<"FooBar"> FooBar;
So everytime you assign a ScriptObjectp into a FooBar the type will be validated, ASSERT_TYPE can be made to be a DEBUG only thing.


==Thats it!  Or details==
==Thats it!  Or details==
7

edits

Navigation menu