Nasal for C++ programmers: Difference between revisions

Jump to navigation Jump to search
m
http://flightgear.org/forums/viewtopic.php?f=30&t=20857&p=190395#p190395
mNo edit summary
m (http://flightgear.org/forums/viewtopic.php?f=30&t=20857&p=190395#p190395)
Line 23: Line 23:


Finally, there's a plethora of FlightGear-specific modules in $FG_ROOT/Nasal that greatly simplify coding stuff from scratch.  
Finally, there's a plethora of FlightGear-specific modules in $FG_ROOT/Nasal that greatly simplify coding stuff from scratch.  
There are two aspects to Nasal: that of interaction with itself and with the property tree.
For instance, to control an aircraft in a scripted fashion, the property tree is going to be your communication with the wider FlightGear code.
Nasal also can use its own mechanisms (library functions/APIs) to interact with different things (file system, route manager, fgcommands, ...). In interest of the web browser analogy, XML in FlightGear is like HTML.
Specifically it is responsible for setting up much of the property tree that FlightGear's subsystems act off of. David Megginson (creator of FG's property tree) once said that "XML should provide the nouns, Nasal should be the verbs" (or something, that isn't a direct quote)
{{cquote|<nowiki>Basically my rule is that markup languages are nouns and
adjectives, while programming languages are verbs and adverbs.  You
use a markup language to describe information and programming languages to
act on it.</nowiki><ref>{{cite web |url=http://www.mail-archive.com/flightgear-devel@flightgear.org/msg07574.html|title=<nowiki>Re: [Flightgear-devel] x++ The World's First XML-Based ProgrammingLanguage</nowiki>|author=<nowiki>David Megginson</nowiki>|date=<nowiki>Tue, 09 Jul 2002 11:07:39 -0700</nowiki>}}</ref>|<nowiki>David Megginson</nowiki>}}
<references/>
So PropertyList XML is really good at providing data that Nasal can work off of. For like the fox2.nas script, this means that ideally all of the specific data about the missile would be taken from Nasal and stored in an XML file (which would be loaded by the Nasal file and the data would be copied over).


== Some words on Nasal for fellow C++ programmers ==
== Some words on Nasal for fellow C++ programmers ==

Navigation menu