Javascript and OS development

Programming, for all ages and all languages.
Post Reply
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Javascript and OS development

Post by os64dev »

Probably you think what has Javascript (JS) to do with OS development, well i am not sure yet either. It just occurred to me that one can build websites(GUI) with JS and judging on the work of ExtJS integrate it with an OS using Adobe Air for instance. This means that you can develop an application which runs in both a browser and natively in an OS framework. Fun stuff, but what if you can have native JS in your OS... Any one has an opinion in advantages and disadvantages?

Currently i am implementing some form of class (OO) support in JS, meaning classes with public, private and static members and methods. Also partial class support is available. A class can be created like:

Code: Select all

myClass = 
classCreate( 
    {   ctor : function () {
            var self = this;
            var privateVar = <value>;
            var privateFunc = function () {
                //- access to <public, private> via self.
            }
            this.privilegedFunc = function () {
                //- access to <public, private> via this.
            }
        },
        publicVar : <value>,
        publicFunc : function () {
            //- access to <public> via this.
        }
    },
    {   staticVar : <value>,
        staticFunc : function () {
            //- access to <static> via <classname>.
        }
    }
)
Also support for single inheritance is made, but there are some problems/design desicions regarding partial classes. Consider the following code:

Code: Select all

myClass = 
classCreate(
    {   ctor : function () { }
        func1 : function () { }
    }
)

myClassExt = 
classExtend(
    myClass,
    {
        funcExt : function () { }
    }
)
This gives a class 'myClass' with the function 'func1' and a class 'myClassExt' with the functions 'func1' and 'funcExt' but as said before there is partial class support thus what would happen is we do

Code: Select all

myClass = 
classExtend(
    myClass,
    {
        func2 : function () { }
    }
)
Do i now also have 'func2' available in 'myClassExt' due to the earlier defined inheritance or do i only add the 'func2' to 'myClass'. The former is available now but i have some doubts. What do you think?
Author of COBOS
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Javascript is a scripting language (although personally I would integrate GameMonkey script or LUA), and there are many useful features for a scripting language in an OS; programmable macros, shell scripts, startup scripts, etc.
My OS is Perception.
Post Reply