Josh @ Dreamland
|
|
Posted on: March 26, 2010, 09:25:32 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
|
Josh @ Dreamland
|
|
Reply #2 Posted on: March 26, 2010, 10:24:20 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
|
RetroX
|
|
Reply #4 Posted on: March 27, 2010, 08:42:35 am |
|
|
Master of all things Linux
Location: US Joined: Apr 2008
Posts: 1055
|
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)Why do all the pro-Microsoft people have troll avatars?
|
|
|
Josh @ Dreamland
|
|
Reply #5 Posted on: March 27, 2010, 08:52:12 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
The same way it works in GM:
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
|
|
|
|
Josh @ Dreamland
|
|
Reply #7 Posted on: March 27, 2010, 08:59:16 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
|
Josh @ Dreamland
|
|
Reply #9 Posted on: March 28, 2010, 09:54:25 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #12 Posted on: March 28, 2010, 12:28:42 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
polygone
|
|
Reply #13 Posted on: March 28, 2010, 12:34:04 pm |
|
|
Location: England Joined: Mar 2009
Posts: 794
|
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.
|
|
|
Josh @ Dreamland
|
|
Reply #14 Posted on: March 28, 2010, 12:57:29 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
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
|
|
|
|