• Bubble
  • Bubble
  • Line
Next Scripting Framework - The next generation OOP
Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2017-03-13T19:15:00Z
  • 2 min to read

NSF is a highly flexible Tcl based, object oriented scripting language which can be used to build other OOP languages like NX.
NX is the next generation object oriented programming system.
It;s one of the things that kept me going and developing software in Tcl an obscure yet powerful language.
It's also per default supported with the NaviServer webserver and the OpenACS platform.
I've used TclOO for my Codru - LostMVC web framework and then switched and rewrote everything in NSF / NX.

A tutorial that scratches the surface of the powerful NX/NSF will help you in getting started.

It has some unique things which change the way you write OOP programs. It was built on the strengths of XOTcl.

We have nx::Class and nx::Object
Both are interconnected and form the power of the system.

NX's power is drawn from the fact that you can create objects directly without having any class. It's kind of what javascript does with objects but at an extraordinary level.
Those objects can then inherit certain functions via mixin
This is a simple and clean way to generate singletons for example.
We can create new objects dynamically and on the fly.
This means that we can dynamically change the structure of an object and a class while the code is running.
Hot code patching as we may call it.
The power of the system is that we can then pass an object around in a variable (passed by reference).
This way I was able to create some funky stuff.

One of the biggest powers of NX/NSF is it's introspection functions which allows you to analyze filters, methos, mixins, slots, variables.. and precedence of functions.

Dynamic Code

NX/NSF support dynamic state changes. Dynamic behavior changes.
Dynamic changes of the class structure and dynamic software composition.
We can also dynamically inject code.

Read more about the dynamic nature of NSF and NX at it's homepage.


NX presents us with again something unique. We can implement positional and non positional parameters.
This means we can pass paramters to a function without having to remember the exact position in the function.
Increasing productivity and decreasing bugs.

obj function -x 3 -y 134 abcobj function -y 3 -z "Oh yeah" -y 134 abc


We can easily make the non positional paramters optional.

Here are some examples of the beauty of NX.

Unknown Method Call
Whenever a command doesn't exist you don't want to give an error. You'd rather try to figure out what the user wants to do!
Or maybe log this somewhere? The possibilities are endless! Thank you Tcl for the unknown construct idea.

Simple Traits
Composite Traits

Abstract Type
Add variable
Constraint Genericity
Multiple Distinct Objects
Polymorphic Copy
Object Serialization
Single Inheritance


Having used NX and NSF in multiple projects for almost 2 years I can certainly say that it helped me write better software.

Ideas and comments

Andrei Clinciu
Andrei Clinciu

I'm a Full Stack Software Developer specializing in creating websites and applications which aid businesses to automate. Software which can help you simplify your life. Let's work together!

Building Great Software
The digital Revolution begins when you learn to automate with personalized software.

Find me on social media