Skip to content

export keyword #121

Closed
Closed
@ghost

Description

I was wondering if it'd be possible to add an export keyword. The reason is that in some JavaScript environments (hint hint, QtScript) people tend to require certain variable on the global scope. However, with the QtScript transition to V8, adding them to the "this" property will become a strict mode error if you don't use .call on a method, furthermore, many implementations don't posses a window-like object for the global scope.

The solution is to use the bare mode, but this isn't desirable. Instead I would propose the use of a special keyword, export.

a = 1
function randomNumber
 ...
export function eventAttacked victim, attacker
 ...

Might compile to:

var eventAttacked;
(function(){
 var a;
 eventAttacked = function (victim, attacker) { ... }
 function randomNumber () { ... }
 a = 1;
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions