HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.19k stars 655 forks source link

Issue 512 - HTML5 Integration - haxe #512

Closed issuesbot closed 11 years ago

issuesbot commented 11 years ago

[Google Issue #512 : https://code.google.com/p/haxe/issues/detail?id=512] by ncanna...@gmail.com, at 22/09/2011, 20:31:34 Check for possible inclusion of StdJs HTML5 into haXe standard library :

https://github.com/xirsys/stdjs/

issuesbot commented 11 years ago

[comment from ncanna...@gmail.com, published at 17/04/2012, 10:28:04]

issuesbot commented 11 years ago

[comment from tong.disktree@gmail.com, published at 17/04/2012, 11:40:33] https://github.com/tong/hx.html5 might help too

issuesbot commented 11 years ago

[comment from ncanna...@gmail.com, published at 06/06/2012, 09:19:28] I guess some questions need to be answered :

issuesbot commented 11 years ago

[comment from ah.duros, published at 06/06/2012, 21:11:25] I've been experimenting with (2) over at https://github.com/aduros/Browser.hx. It was originally (1) but was a huge amount of unused parsing and slowed down compiles noticeably (at least on this old laptop). I'm thinking about converting it over to (3) once wildcard imports are in.

I'm not sure if I'll be able to maintain Browser.hx long-term, I'd rather merge it with one of the existing haxelibs. I do strongly think parsing IDLs and automatically generating externs is the way to go.

issuesbot commented 11 years ago

[comment from ncanna...@gmail.com, published at 28/07/2012, 09:46:49] It seems that xirsys_stdjs makes several changes in JS core objects prototypes. We used to so in Haxe as well, but we stopped starting from 2.10. We would like to include parts of the HTML5 API in Haxe/std for 3.0 but I think we would have to remove all these changes, especially since it seems to cause several issues with other libraries.

issuesbot commented 11 years ago

[comment from jason.on...@gmail.com, published at 28/07/2012, 11:38:37] I think the changes that are injected into Object have been removed on git:

https://github.com/xirsys/stdjs/commit/a288e5577304fe507de463c8a62c2e0ccda7ccd2

Though this hasn't been updated for the haxelib yet. Other than that I think the library doesn't modify any standard JS objects. (Possibly XmlHTTPRequest? Will have to check again).

The weird behaviour with the "hasOwnProperty()" function in the Object extern seems to persist.

issuesbot commented 11 years ago

[comment from tophattedcoder, published at 07/10/2012, 20:31:28] Will this include an ArrayBuffer/Uint8Array backend for haxe.io.Bytes on the JS target?

issuesbot commented 11 years ago

[comment from niel.dru...@googlemail.com, published at 28/10/2012, 13:56:01] I think before going on, there are some issues that need to be solved in a conform way, otherwise you'll build technical debt and have future issues like 'why doesn't haxe work with browser XYZ', or 'I cant use webgl with canvas2D'.

Languages like Dart and TypeScript are either leaning towards Webkit or IE, it is easier for them to decide on contentious issues, and generate code as they need it. And so, haxe must decide how to deal with vastly differing browser implementations:

Since a result type of Dynamic is still invariant as soon at it is used, we do not deal elegantly with:

For the latter, this makes the webgl API difficult to use, because you can not use the API as it was designed to be used.

Does the new policy 'no function injection' exclude the use of wrapper methods to make the API easier to use? e.g. canvas.getContext2D, canvas.getContextWebGL ?

A useful additional feature that would solve this is to the extend the annotation @ :overload to be able to check for constant identifiers.

Also, there's the issue of scope:

issuesbot commented 11 years ago

[comment from ncanna...@gmail.com, published at 28/10/2012, 14:33:07] I agree with all the points you make Neil.

The idea of an HTML5 API is to provide something "low level", that does not perform any browser detection-and-fallback implementation. This is the job of actual libraries to provide a high level cross browser API.

It means we want to include all the latest things such as WebGL. It will be up to the developer to check which browser supports it and adapt its code based on this.

It is still possible to define inline methods in extern classes in order to provide utility functions or type-safety since these will not get generated into the runtime. However they should clearly be documented as Haxe additions.

issuesbot commented 11 years ago

[comment from ah.duros, published at 10/12/2012, 07:01:17] Committed in 10e7d2fbbd697610888f7b96e54b4e36500459a6. Please test and report bugs!