Giter VIP home page Giter VIP logo

lux's Issues

global namespace pollution

Should review the code so that only a minimal number of global objects are exposed. Ideally, only Lux and Shade should exist. (I could put Shade inside Lux, but I think a lot of code would look bad. The same goes for vec* and mat*)

Graphing Calculator demo borked

Uncaught TypeError: Object # has no method 'indexOf' lux.js:16909

Looks like the remove function is treating scene as an array instead of an object. I was going to send a pull request, but I don't see a list of actors anywhere.

I'd love to see the graphing calculator working!

Shade() should check for multiple parameters

I've been bitten by typing Shade(x, y, z) instead of Shade.vec(x, y, z). We should either check for multiple parameters or actually just call Shade.vec() in case we get more than one parameter.

performance vs. convenience in API (to type-check or not to type-check?)

Since Javascript is dynamically checked, if a user passes a bad value into a function, the error might only manifest itself much further down the code. Tracking this error down is a slow and opaque problem: the error message will typically come from the innards of Facet, which will confuse users that are not intimately familiar with the library (at present, anyone but me).

The easy way to solve this problem is to add a strict layer of type-checking into every function. This works, but carries a runtime penalty, and good code pays the cost of debugging over and over again. This is not a problem if the API call is not on the application hot path, but some calls are unavoidable: anything that happens per-frame on WebGL should be considered on the hotpath, since spare cycles can be used for more features.

The easy way to solve this problem is to add a strict layer of type-checking into every function. This works, but carries a runtime penalty, and good code pays the cost of debugging over and over again. This is not a problem if the API call is not on the application hot path, but some calls are unavoidable: anything that happens per-frame on WebGL should be considered on the hotpath, since spare cycles can be used for more features. The canonical example of this type of thing is in https://github.com/cscheid/facet/blob/master/src/shade/parameter.js .

I'm leaning towards creating two sets of methods, the slow, type-checked method, and the fast, non-type-checked version.
But what's the best way to expose this in an API? Is it even hopeful to do something like this robustly and effectively?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.