Talk:FGPythonSys: Difference between revisions

Jump to navigation Jump to search
Line 76: Line 76:
:: In summary, you are correct of course, but it's more to do with existing code and features than with the Nasal the language/VM or the underlying subsystem.  The main issue here is 3-fold: 1) timers, 2) listeners, 3) tons of spaghetti code in $FG_ROOT/Nasal loaded/executed unconditionally.
:: In summary, you are correct of course, but it's more to do with existing code and features than with the Nasal the language/VM or the underlying subsystem.  The main issue here is 3-fold: 1) timers, 2) listeners, 3) tons of spaghetti code in $FG_ROOT/Nasal loaded/executed unconditionally.
:: Anyway, I am willing to help work out decoupling Nasal accordingly, including overlapping work that covers/touches FGPythonSys (i.e. common APIs).--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 18:21, 15 February 2016 (EST)
:: Anyway, I am willing to help work out decoupling Nasal accordingly, including overlapping work that covers/touches FGPythonSys (i.e. common APIs).--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 18:21, 15 February 2016 (EST)
:: EDIT: Here's a simple cppbind-based Nasal binding [https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Scripting/NasalAircraft.cxx]


== How to deal with Subsystem specific bindings (Python & Nasal) ==
== How to deal with Subsystem specific bindings (Python & Nasal) ==


it would make sense to come up with a helper class (adapter) that abstracts away the registration of APIs/data structures that are to be supposed to scripting space, so that a subsystem does not need to call lower-level APIs that are scripting language specific, but just a single abstraction layer that hides the marshaling details to convert data structures and function/method calls between C++ and scripting code. For the time being, there is a lot of ugly "postInitFOO()" logic all over the place to add subsystem-specific APIs to the Nasal namespace [https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Scripting/NasalSys.cxx#l58]. --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 18:31, 15 February 2016 (EST)
it would make sense to come up with a helper class (adapter) that abstracts away the registration of APIs/data structures that are to be supposed to scripting space, so that a subsystem does not need to call lower-level APIs that are scripting language specific, but just a single abstraction layer that hides the marshaling details to convert data structures and function/method calls between C++ and scripting code. For the time being, there is a lot of ugly "postInitFOO()" logic all over the place to add subsystem-specific APIs to the Nasal namespace [https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Scripting/NasalSys.cxx#l58]. --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 18:31, 15 February 2016 (EST)

Navigation menu