Closed Bug 492942 Opened 16 years ago Closed 6 years ago

Cumbersome to invoke functions, constructors; better API called for

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
Future

People

(Reporter: lhansen, Unassigned)

References

Details

(Following a discussion on tamarin-discuss.) We should have one-stop APIs for common functions like looking up classes and global bindings; invoking functions and constructors; and so on, exposed through our nascent API system.
I'll propose the approach we took in TT for calling into AS3 from C++: Let an AS3 function be annotated with [some-metadata], causing nativegen.py to generate a friendly C++ entry point that calls the function. Host code calls the generated entry point. This works for bound entry points, not for calling closures, however it isn't hard to make your own entry point for calling closures (written in AS3), and pass the closure to it, and use AS3 to invoke the closure.
That doesn't work too well with loaded ABCs or even loaded (eval'd) source code, though - if their contents aren't known when the exe is built.
(In reply to comment #2) > That doesn't work too well with loaded ABCs or even loaded (eval'd) source > code, though - if their contents aren't known when the exe is built. Agreed, but it's a (very) useful subset.
It would be fantastic to have a C++ template-driven calling path which takes a name + typed argument, and does the right casting (or errors) based on what you are calling. I've written these myself, and there are many such out there for Lua integration (among other languages). You would give it an Atom pointing to a ScriptObject, the name of the method, and parameters. Something like: callMethod(myScriptObject, "doWork", 1, anotherScriptObject, "A string."); There should also be an easy function for getting the value of a variable. ie Atom *varValue = toplevel()->lookupGlobal("SomeClass.AStaticVariable"); The same for setting would be nice as well. Right now the API to look something up is incredibly convoluted (which is not so bad) and very difficult to debug (which is bad). For someone who is not privy to the innards of the runtime, stepping through to figure out why your lookup is failing is incredibly difficult. Obviously you still need to have the ability to do lookups via QName and other complexities, but most of the time, people are going to want to call a public method on a class which they have a pointer to, and that path should be pretty easy to smooth.
Target Milestone: --- → Future
Linking to the ANI tracker for further consideration in that project. Leaving targeted to Future.
Blocks: ANI
Flags: flashplayer-qrb+
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.