1 - Introduction

I suck at writing documentation, so this will be short and bitter. For working samples, check out scripts/tests/*.ns

Nesla's earliest lines of code were derived from all the configuration file parsers I kept writing over and over, and was never happy with. With the hassle of writing new functions to deal with different files, and adding callback functions to deal with subsections, and _then_ taking the parsed data and making that data accessible to other loaded functions and modules, not to mention the whole memory management part, and the need to keep track of not only the name and type of variable, but also the size... Well, I guess I'm just lucky I have a sense of humour.

So here was a goal: A flexible config parser, a simple and universal data storage model, a short and simple command set, a zero effort memory management system that didn't suck, and a C api that wouldn't be painful or difficult to use in other projects. Whether or not it became a fully functional scripting language of its own was entirely incidental. What I ended up with is the Nesla core library; the scripting language for C programmers.

Syntactically, Nesla probably looks more like javascript than it does any other language. Use of the word 'object' may be less than 100% accurate, there are no properties, methods, events, or classes in the javascript sense, but the C syntax rules are nearly identical. Nesla is not an emulation of javascript, but both language designs do agree that C syntax is good and dollar signs are ugly.


OOPS So here's the deal on 'Object Oriented Programming'. I don't get it. I'm not saying it's bad or that people who do it are deviants. I'm just not sure what the working definition of OO is these days. Nesla's storage system is entirely object-based, but that doesn't make the language object oriented. I added a 'this' variable so functions could infer the context in which they were called. Does this make Nesla an OO language? Consider the following code:

function new_str(val) {
        this = {
                size  = function () { return sizeof(this.value); };
                lower = function () { return string.tolower(this.value); };
                upper = function () { return string.toupper(this.value); };
                value = val;
        };
        return this;
}
x=new_str("AbC");
print("["+x.size()+"]\n");  // will print 3
x.value="aBcDeF";
print("["+x.size()+"]\n");  // will print 6
print("["+x.lower()+"]\n"); // will print abcdef
print("["+x.upper()+"]\n"); // will print ABCDEF

Is that technically an example of OO? True, most OO code has nicer looking constructors and classes and stuff I don't get, but this is working Nesla code.