Pages: 1 2 3 4 »
  Print  
Author Topic: execute_string via Google V8  (Read 7619 times)
Offline (Male) Josh @ Dreamland
Posted on: March 26, 2010, 09:25:32 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
GML's consistency with C++ is nothing compared to that with JavaScript. I could add a newline after everything and not have to worry about adding semicolons. Hell, I could put everything in parentheses, too; I wouldn't even need a lexer. V8 is amazingly fast, and it compiles the JS Just-in-Time.

I believe I mentioned earlier that JavaScript even has a with().

I'm vaguely familiar with the workings of V8, and it would not be difficult to use some basic accessors to simulate odd effects of GML, such as speed/direction - hspeed/vspeed correlations.

Functions are also amazingly simple to add to either language across V8.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) serprex
Reply #1 Posted on: March 26, 2010, 10:14:55 pm
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
No
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: March 26, 2010, 10:24:20 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
That wasn't very constructive.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) score_under
Reply #3 Posted on: March 27, 2010, 07:32:32 am

Member
Joined: Aug 2008
Posts: 308

View Profile
http://enigma-dev.org/vector/torllh.svg
Logged
Offline (Male) RetroX
Reply #4 Posted on: March 27, 2010, 08:42:35 am

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
int x,y=5;
execute_string("x="+string(y)+";");

How would this work, then

Also, as long as an execute_string is constant, the execute_string part should just be removed and compiled for speed.
« Last Edit: March 27, 2010, 08:44:40 am by RetroX » Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: March 27, 2010, 08:52:12 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
The same way it works in GM:
Code: [Select]
var xx,yy;
xx = 0;
yy = 5;
execute_string("xx="+string(yy)+";");
show_message(string(xx));
Shows zero; execute_string() gets its own scope.

Now, had I used "x" as you proposed, it also would have behaved like GM: execute_string() would call V8, V8 would see "x" which is implemented as an accessor. The accessor will load the current instance (as determined by the C++ proceedings of ENIGMA)'s x coordinate and return it for the JavaScript to use and to write to. Accessors have both a read and and write C++ event.

And by "own scope," I mean a scope from which it cannot find "var xx" and must use this->xx.
« Last Edit: March 27, 2010, 08:53:44 am by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #6 Posted on: March 27, 2010, 08:56:27 am

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Yes, but that isn't how GM does it.  If you're aiming for compatibility, you can't require pointers for execute_string.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #7 Posted on: March 27, 2010, 08:59:16 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
What? That had nothing to do with pointers... GM users won't even know it's running V8 or that anything is being passed by pointers. It'll look to them just like it did in GM.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) luiscubal
Reply #8 Posted on: March 27, 2010, 05:01:30 pm
Member
Joined: Jun 2009
Posts: 452

View Profile Email
I'd expect execute_string(and execute_file, btw) to parse and behave EXACTLY like GML files.
Since V8 != your parser, execute_string would fail on things your parser won't fail(I assume).
Logged
Offline (Male) Josh @ Dreamland
Reply #9 Posted on: March 28, 2010, 09:54:25 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
Only on C++ things that aren't in GML. Since execute_string is more for compatibility, I'm not concerned with having it support C, really.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) luiscubal
Reply #10 Posted on: March 28, 2010, 11:31:47 am
Member
Joined: Jun 2009
Posts: 452

View Profile Email
V8 executes JS, not GML.

In JS, for instance, there is no "global" keyword, no "begin"/"end"(only {}), etc.
Logged
Offline (Unknown gender) Game_boy
Reply #11 Posted on: March 28, 2010, 11:51:57 am
Member
Joined: Apr 2008
Posts: 228

View Profile
Can you try and concentrate on getting working GM support before adding nice extras like execute_string or JS compatibility?

Every time you get close to a release you decide on some massive new feature that requires recoding the whole thing (in this case, replicating absolutely everything GM does in JS), and it's getting a bit repetitive. Last time it was C++. Don't try and say it will only take X days, because you know something like that will take 6 months minimum once you get into the tiny quirks.

Please don't.

Logged
Offline (Male) Josh @ Dreamland
Reply #12 Posted on: March 28, 2010, 12:28:42 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
Hah, true. Don't worry though, this isn't to be implemented yet. I added that C compiler because I don't want more mediocrity; GM users are content with that for now, but I want my beautiful C++ types. And I like the idea of structures. So I just went all-out.

This, however, does not appeal to me. So I will let it sit here until it gets eroded smooth by anyone who posts on the matter.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) polygone
Reply #13 Posted on: March 28, 2010, 12:34:04 pm

Contributor
Location: England
Joined: Mar 2009
Posts: 794

View Profile
I don't think this would really ever be worth the effort, surely the time could always be spent on something more beneficial than this?
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) Josh @ Dreamland
Reply #14 Posted on: March 28, 2010, 12:57:29 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
The idea is for this to require very little effort. It'd be almost entirely code-generated code. But yes, I could find better things to spend time on.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: 1 2 3 4 »
  Print