Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread Brandon Andrews
Lately I've been writing very processor heavy Javascript. I feel like it could benefit a lot from having a syntax feature for removing debug statements. Obviously JS is interpreted and not compiled, so I'm not sure if this sounds completely unrealistic, but it has some very useful scenarios. I

Re: Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread David Bruant
Le 28/11/2013 09:59, Brandon Andrews a écrit : Lately I've been writing very processor heavy Javascript. I feel like it could benefit a lot from having a syntax feature for removing debug statements. Obviously JS is interpreted and not compiled, so I'm not sure if this sounds completely

Re: Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread Erik Arvidsson
Both Closure Compiler and UglifyJS has something called defines which allow you to override the value of a variable using a command line parameter. Combining this with their dead code removal and you have a preprocessor tool similar to #ifdefs.

Re: Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread Filip Pizlo
On Nov 28, 2013, at 12:59 AM, Brandon Andrews warcraftthre...@sbcglobal.net wrote: Lately I've been writing very processor heavy Javascript. I feel like it could benefit a lot from having a syntax feature for removing debug statements. Obviously JS is interpreted and not compiled, so

Re: Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread Boris Zbarsky
On 11/28/13 11:41 AM, Filip Pizlo wrote: Here's why var is good enough provided that you do the var debug = false thing at the top of the function: I would think it would be done at window scope, or in some module scope, not at the top of every function, no? -Boris

Re: Using const to remove debug code? Is there something stopping implementers from doing this?

2013-11-28 Thread Filip Pizlo
On Nov 28, 2013, at 9:51 AM, Boris Zbarsky bzbar...@mit.edu wrote: On 11/28/13 11:41 AM, Filip Pizlo wrote: Here's why var is good enough provided that you do the var debug = false thing at the top of the function: I would think it would be done at window scope, or in some module