let's say i might be working on something ``secret'' and i want to embed a scripting language that isn't too off the wall for end users. i hear luajit is kinda fast and v8 is really fast and speed would be quite nice since user scripts might be called hundreds of thousands of times in short timeframes
i've heard javascript has better semantics and is generally more pleasant to use, but i want /prog/'s opinion so i don't fuck up and regret it later
>>119
weak maps that can't be iterated, which is really convenient considering i iterate them in the vast majority of cases i use them:
local objects = setmetatable({ }, { __mode = "k" })
local function Object (x, y)
local o = { x = tonumber(x) or 0, y = tonumber(y) or 0 }
objects[o] = true
return o
end
while true do
for o in pairs(objects) do
some_update_function(o)
end
end
Name:
Anonymous2012-02-15 13:11
>>120
mozilla really really wants people to use poor old javascript, thank you very much! the internet is a nacl-free zone!
Name:
Anonymous2012-02-15 13:50
>>122
nacl is great for exploiting hidden hardware exploits through injection of arbitrary code
Name:
Anonymous2012-02-15 22:58
>>113
>- they aren't enumerable, because the gc collecting fields would fuck up the iteration
what a bunch of retards.
Name:
Anonymous2012-02-15 23:57
>>124
The next thing you know, JavaScript programmers will be declaring types and calling free() because idiots are trying to abuse the poor language for purposes it was never intended for. JavaScript was a simple language designed for small client-side scripts that run inside a webpage, not distributed computing, binary file manipulation, huge games, or enterprise frameworks. "Web app developers" need to find a new language for client-side scripting before they turn JavaScript into the "Objective-C++/CLI" of the web.
calling something the x86 of anything sure is a compliment!
Name:
Anonymous2012-02-16 0:03
>>126 "I was convinced that we needed to build-in a programming language, but the developers, Tim first, were very much opposed. It had to remain completely declarative. Maybe, but the net result is that the programming-vacuum filled itself with the most horrible kluge in the history of computing: Javascript." - Robert Cailliau the most horrible kluge in the history of computing x86 of the web
Sounds about right.
I'd use lua just because its not jabbashits. The DOM tainted that language forever.
Name:
Anonymous2012-02-18 17:52
Just tried lua.js. Works pretty nice, some built-in functions missing, notably table.concat. No showstoppers, though. All IO is also missing, except print, which outputs to console. I guess someone should write XHR, websockets and local storage library for it. Canvas, events and maybe some DOM-support would be nice too...
Seems like you can run Lua on following platforms, ie. pretty much anywhere.
Nearly all desktop operating systems; All Linux, 32/64-bit Windows, OS X, *BSD, Solaris, Haiku, etc.
Nearly all smartphone platforms: Symbian (incl. Java ME), Android, iOS, Windows Phone 7 (LuaCLR, Kopi Lua, etc.), BlackBerry
Web platforms; Web browsers capable for running Javascript, Adobe Flash, Wikipedia templates
Bytecode based VMs; .net, JVM, LLVM.
Embedded platforms; Many PS3 and Xbox 360 games use Lua, most Canon cameras via CHDK and Magic Lantern, MP3 players supported by Rockbox, large memory (128kB+ RAM) microcontrollers (eLua), many wireless routers (dd-wrt, Tomato, etc.), and a lot more.
>>143 __mode and __gc metamethods are not supported
lol javascript
harmony mode: only the 'k' option of __mode is supported and iterating the table is a bad idea please dont do it
Name:
Anonymous2012-02-18 18:45
JavaScript is an abomination. The only good thing about it is that it's "higher-level than C." Wow! Of course a scripting language for the web is higher-level than a compiled systems language!
I did the julialang.org perftest with luajit2. $ luajit2 test.lua
luajit2,fib,0.21
luajit2,parse_int,0.53
luajit2,mandel,4.8
luajit2,quicksort,2.3
luajit2,pi_sum,34
luajit2,rand_mat_stat,110
luajit2,rand_mat_mul,16.84
$ node test.js
javascript,fib,0.242
javascript,parse_int,0.497
javascript,mandel,1.376
javascript,quicksort,3.08
javascript,pi_sum,32.2
javascript,rand_mat_stat,66
javascript,rand_mat_mul,62354
But I don't think this is valid, I've found things like 1 < x < 10, unused variables, arithmetic on undefined and NaN values...
Anyway, Luajit is quite on par with V8, but totally outperforms V8's rand_mat_mul time. With this, I can conclude that V8 is amazing, but it was really designed for the web, not as a scientific scripting language, and -- Lua, I choose you!
>>39
I was reading this thread just now, and farted loudly in the middle of reading >>38.
Then, I scrolled down, saw your post, and was so amused by the coincidence that I had to tell you about it.