ClosestStorm / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Bug Report #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Discovered a bug:

Commenting out code at the of included files like //xyz throws an error: 

SyntaxError: Unexpected end of input

Original issue reported on code.google.com by bienmano...@googlemail.com on 7 Oct 2009 at 9:09

GoogleCodeExporter commented 9 years ago
Functions are not global.

in a required file:
function dumps () { ...

in another file:
dumps(x);

causes "ReferenceError: dumps is not defined"

Critical!

Original comment by bienmano...@googlemail.com on 7 Oct 2009 at 10:03

GoogleCodeExporter commented 9 years ago
Required functions are not global. This is a feature, not a bug :) (and v8cgi 
differ
from PHP in this one)

In a required module, you explicitely _define_ (via the "exports" variable) 
what do
you want to export. Please see http://jshq.org/commonjs/0.1/modules.html for 
more infos.

Original comment by ondrej.zara on 13 Oct 2009 at 7:34

GoogleCodeExporter commented 9 years ago
I understand that now... my problem is, there is not enough example-code "to 
learn"
it to use it to create web-sites, although i think v8cgi is faster (to work 
with) and
has cleaner-syntax as php (and makes more fun at all!)

Another possibility is to declare with var x = this.x (keeto - mykesx? - use 
this
method for the jx.raccoon-framework)

Original comment by bienmano...@googlemail.com on 14 Oct 2009 at 2:10

GoogleCodeExporter commented 9 years ago
To emulate PHP behavior, one can use the include() function:

--- mymodule.js ---
exports.func1 = function() {}
exports.func2 = function() {}

--- main code ---

include("mymodule.js");
func1();

Original comment by ondrej.zara on 14 Oct 2009 at 6:16