elm-community / webgl

Moved to elm-explorations/webgl
https://package.elm-lang.org/packages/elm-explorations/webgl/latest
BSD 3-Clause "New" or "Revised" License
130 stars 18 forks source link

use a lazy loading getter for native things #13

Closed eeue56 closed 8 years ago

w0rm commented 8 years ago

@eeue56 thanks for the proposal, I'm still thinking that having simple getter functions is less error prone because it allows to find undefined functions, and allows to track the dead code with the current .eslint setup.

Also, even if we don't really support ie8, it's still good to not break its parser with the js code that contains get keywords.

w0rm commented 8 years ago

I will work on my solution to this problem.

eeue56 commented 8 years ago

FWIW, browser support is not a valid concern to close this PR. Every modern browser supports get functions - more than support webgl, including mobile. So, that's an invalid concern.

eeue56 commented 8 years ago

Compare this:

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API

with this:

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/get

Notice that webgl does not work on a lot of platforms, whereas the getter style in this PR are supported on every platform. Browser support is a strawman argument.

w0rm commented 8 years ago

@eeue56 if WebGL is not supported, then the library should render a div. But if the browser cannot parse the source code, it will break the whole application.

Browser support was not the only concern.

eeue56 commented 8 years ago

@w0rm Elm does not support IE 8 anyway, so again, it's not a valid concern.

But yeah - other approaches are fine. I'm just saying that browser support is not a valid concern, and that you shouldn't be afraid of getters.

w0rm commented 8 years ago

@eeue56 sorry for being conservative here. I really care about the library, and I want to avoid silly things like this:

screen shot 2016-11-23 at 22 46 38