- From: <bugzilla@jessica.w3.org>
- Date: Wed, 23 Nov 2011 21:24:27 +0000
- To: public-script-coord@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=14878 Tab Atkins Jr. <jackalmage@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jackalmage@gmail.com --- Comment #17 from Tab Atkins Jr. <jackalmage@gmail.com> 2011-11-23 21:24:26 UTC --- (In reply to comment #16) > (In reply to comment #15) > > For dense sets in [0,31], bitfields are still more verbose and less usable. > > You have > > > > if (foo & Foo.a & Foo.b & ~Foo.c & Foo.d) > > vs. > > if (foo.a && foo.b && !foo.c && foo.d) > > Read what I wrote again: union, intersection, differencing. I never write > "membership testing". Yeesh. > > Your overlong comment ignores actual use-cases of numeric consts in WebIDL, > notably https://www.khronos.org/registry/webgl/specs/1.0/. > > Do not impose policy at the level of mechanism. The only case of a bitfield I could find in WebGL was the argument to the clear() function, which seems to be bad in similar ways to other things argued in this thread. WebGL makes extensive use of constants as simple arguments (not, as far as I can tell, useful to use as sets which can be unioned, intersected, or differenced), which appears to also be bad in the way already argued in this thread. All of these appear to exist solely because of copypasta from the C API, and could be replaced by a string instead in the JS API which would be shorter and likely more readable. In some cases, like getParameter and getBufferParameter, the API is *really* bad and should, in JS, just be individual properties or methods. I would hope you're not arguing for that pattern to be something to design towards! Overall, the WebGL API is *horrible* from a JS standpoint, purely so it can interoperate more directly with the C API. There are some valid uses of constants within JS. The Math object exposes several. The TypedArray objects expose their width as constants as well. These are much rarer than the bad uses. -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
Received on Wednesday, 23 November 2011 21:24:33 UTC