By the way, it's a good thing that Visual Basic never caught on as a browser scripting language during aIEeee's market share peak years. That would have been miserable.
Anyway, if Duktape ends up being any good, I may consider it as a scripting engine for Citadel. I like Python as much as the next guy, but we've already got so much of the web-side platform written in JavaScript, there are a lot of possible synergies there, and the benefit of not having to get our build system to deal with the host's Python universe is a big win.
yea, V8 is only portable to ARM, i386 and x64, which in our situation is not acceptable.
However, the biggest server side ecosystem was developed for the V8 ecosystem: nodejs.
so, pure library portability will only be there for V8 - which is why triangens hat chosen it for arangodb.
when google forked webkit, they did this for a reason. it clung them to an API which they didn't want to follow anymore, since it had performance implications.
the result is, that V8 did a fundamental api change, which in the case of arango took a lot of hard work to follow. For node this also was a major undertaking, the results aren't released yet.
put short, V8 users != chrome are second class citizens.
there are two more js engines which one shouldn't forget about:
spidermonkey: highly portable, and they claim to be fast... sort of http://www.webmonkey.com/2010/09/mozilla-asks-are-we-fast-yet/
The apple engine - as one may expect, apple wants to leverage its existing eco system to get the best for the buck. As you all know, apple invested heavily in LLVM & CLang - so - yes, this became their solution.
Last summer they published their new kid: https://trac.webkit.org/wiki/FTLJIT
While this binds one to the LLVM compiler infrastructure, it sounds most interesting to me...
oh, yes, and while python aims to be easily integrateable, its not a lightweight thing to compile, neither are its dependencies.
So, no chance to do this and the third language in the game is also not acceptable.
Off the current topic, but does anyone here familiar with engines like PHP know if you take a performance hit for building libraries with functions that may not be used by those including the file in their page?
That is, if I created an object with functions that puts data in a database, or retrieves data from the database, those pages that only need to put data in the database might get impacted by the fact that there's code for putting data in the database (which won't get called, but gets pulled in by an include statement anyway)... is that true or false? Or sorta?
(sorry if I'm using particularly terrible English to ask this, my head is in a weird place right now)
requiring additional php files requires additional processing power consumption
if its that what you were asking.
php has to stat the files, load it, parse it, etc.
I think that answers my question.
I figured that the PHP engine has to include the file, interpret what it included (which involves the stuff that you don't intend for the consumer of a library to use as well as the stuff the consumer will use), and make any functions within the included file available to the consumer.
So, hmmm... the next bit is knowing if it takes more processing power to read a new file in than to have a bunch of extra stuff in the included file.
Or, rather, more time ... processing power might be even less, but the file itself might take more time because of having to stat it, read the file in, etc.
It's just a whole side of things I haven't had to think about until now.
With a compiled language, you know that the compiler has done some up-front work in dealing with all this stuff, and the output is something that's kind of streamlined to do what you need. Not exactly the same with a scripting language, where an interpreter has to parse everything in advance.
ProTip:
Recursive functions tend not to come all the way back down the stack if they have a statement like "sys.exit(0)" in them.
<< SMH >>
I spent half a day rewriting code and ultimately wondering whether Python actually has recursion before finding that I had put that trace point in my function. /me needs either more coffee or less, dunno which...
As a general rule, I avoid exit() statements, preferring to use block structures and whatnot, for reasons like this.
Unfortunately, apparently, in PHP, using nested blocks is discouraged according to a popular standard of style used by that community, as they regard nested blocks as 'difficult to read'.
I disagree, but conform to their standards when working with others.
Recursive functions tend not to come all the way back down the stack
if they have a statement like "sys.exit(0)" in them.
<< SMH >>
I spent half a day rewriting code and ultimately wondering whether
Python actually has recursion before finding that I had put that trace
point in my function. /me needs either more coffee or less, dunno
which...
You'reDoingItWrong(tm). Sys.exit(1) in Python is implemented as an exception throw. So it's actually the perfect with to terminate a recursion. Catch SysExit or whatever they call it, and you're golden. <snirk>
throw "yo dawg, I heard u liek trace messages FIXME YOU IDIOT";
You'reDoingItWrong(tm). Sys.exit(1) in Python is implemented as an
exception throw. So it's actually the perfect with to terminate a
recursion. Catch SysExit or whatever they call it, and you're golden.
I've since switched to throwing exceptions when I want the program to come to a screeching halt.
The only problem is, Python doesn't allow you to throw an exception.
throw Exception("foo")
doesn't work. You can't throw an exception; you have to RAISE an exception.
F--k that ... ! If I want to throw an exception, I'm going to throw an exception!
Even if it's just an exception thrown from the fact that there's no "throw" command!
Having lived mostly in the C world for decades, though, I can see already that exception handling justifies all sorts of sloppy programming practices.
Why write good code when you can just wrap the whole damn thing in an exception handler?
Python is ugly, but yet python is beautiful :
http://pyvideo.org/video/1780/transforming-code-into-beautiful-idiomatic-pytho
I used to think exceptions were the bomb.
Now I just think they're a bomb. I prefer more explicit error handling with return codes or the like. I hate having the flow interrupted randomly by who-knows-what deep in the layers of hell.
I guess it has its place, though... I just haven't quite decided for myself where that place should be.
I just read a question that kind of blows my mind.
"I don't understand why cURL come into play? I thought this was using rest?
is cURL a type of rest client?"
(I copied the question literally, punctuation and capitalization errors and all).
That last question blows my mind. Is cURL a type of REST client?
It's one of those questions that exposes what feels like a fundamental misunderstanding of several subtle but important concepts. I'm thankful someone else answered it for him, because I'm not sure how I would have started without coming across as a jerk.
How does that question feel to you guys?