Nasal for C++ programmers: Difference between revisions

Jump to navigation Jump to search
Line 130: Line 130:
* The truth is, there's TONS of Nasal code in the base package that has an impact on performance, because of the way it is written, not primarily because of the well-known GC issues.
* The truth is, there's TONS of Nasal code in the base package that has an impact on performance, because of the way it is written, not primarily because of the well-known GC issues.
* Often, most high quality examples of Nasal code were written by people who also happened to be core developers.
* Often, most high quality examples of Nasal code were written by people who also happened to be core developers.
* So it's way too simple to say that forum users are writing Nasal because they feel it's "just better". And, clearly, nobody on the forum wants to replace fgfs.exe with "nasal.exe"[http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38172.html]. It's really just polemics to suggest that forum users feel "core=bad" and "nasal=good".
* So it's way too simple to say that forum users are writing Nasal because they feel it's "just better". And, clearly, nobody on the forum wants to replace fgfs.exe with "nasal.exe"[http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38172.html]. It's really just polemics to suggest that forum users feel "core=bad" and "nasal=good", forum users tend to contribute in the form of Nasal code, because the barrier to entry is so much lower, and because their work can be deployed much more easily.
* For forum users, it all boils down to an accessibility issue: Nasal is obviously much more accessible than C++ coding.
* For forum users, it all boils down to an accessibility issue: Nasal is obviously much more accessible than C++ coding, not just for the developer of a feature, but also for people wanting to use the feature.
* Yes, it's true, Nasal code makes the main loop non-deterministic, i.e. the garbage collector - but there are people currently working on improving the GC: [[How the Nasal GC works]].
* Yes, it's true, Nasal code makes the main loop non-deterministic, i.e. because of the garbage collector - but there are people currently working on improving the GC: [[How the Nasal GC works]].
* On the other hand, we also have tons of C++ code which is not using smartpointers and yes, which is leaking memory - in other words which is "non deterministic", too (definitely from an embedded developer perspective).
* On the other hand, we also have tons of C++ code which is not using smartpointers and yes, which is leaking memory - in other words which is "non deterministic", too (definitely from an embedded developer's perspective).
* Now "fixing" non-deterministic Nasal code involves re-implementing a single self-contained component (a single C file actually, with ~320 lines of code), the Nasal GC - or even just adding support for an existing GC implementation. Which is something that is currently being worked on by another contributor, so that the GC impact will eventually be not as severe probably.
* Now "fixing" non-deterministic Nasal code involves re-implementing a single self-contained component (a single C file actually, with ~320 lines of code), the Nasal GC - or even just adding support for an existing GC implementation. Which is something that is currently being worked on by another contributor, so that the GC impact will eventually be not as severe probably.
* Making the rest of FG stop leaking memory involves much more work unfortunately.
* Making the rest of FG stop leaking memory involves much more work unfortunately.
Line 139: Line 139:
* Really, writing badly performing C++ code is much easier than writing bad Nasal code. There are only a handful of ways to crash FG from Nasal.
* Really, writing badly performing C++ code is much easier than writing bad Nasal code. There are only a handful of ways to crash FG from Nasal.
* And writing/reviewing Nasal code doesn't involve the same skills that C++ programming requires.
* And writing/reviewing Nasal code doesn't involve the same skills that C++ programming requires.
* Nasal code doesn't need to be reviewed and committed by core developers - it can be reviewed by other Nasal programmers.
* Nasal code doesn't need to be reviewed and committed by core developers - it can be peer-reviewed by other Nasal programmers, which is often happening on the forums.
* And, we've seen quality C++ code submissions which ended up not being committed or even reviewed.
* On the other hand, we've seen quality C++ code submissions which ended up not being committed or even reviewed for months (or even years)
* Deploying contributions written in Nasal is MUCH simpler, and doesn't involve any core developers!
* Deploying contributions written in Nasal is MUCH simpler, and doesn't necessarily involve any core developers!
* When compared to Nasal, we have less people in the FG communtiy who know how to program C++ and who know how to build FG from source, that's what it all boils down to, really.
* When compared to Nasal, we have less people in the FG communtiy who know how to program C++ and who know how to build FG from source, that's what it all boils down to, really.
* We cannot possibly replace or rewrite the sheer amount of scripted code we have, and looking at all the features implemented in Nasal, most of them cannot as easily, or simply shouldn't be implemented in C++ at all. After all, FG is all about being open and extendable for end-users.
* We cannot possibly replace or rewrite the sheer amount of scripted code we have, and looking at all the features implemented in Nasal, most of them cannot as easily, or simply shouldn't be implemented in C++ at all. After all, FG is all about being open and extendable for end-users.

Navigation menu