Andreas Rossberg (2013-12-20T13:32:40.000Z)
domenic at domenicdenicola.com (2014-01-06T13:49:17.430Z)
On 20 December 2013 04:05, Brendan Eich <brendan at mozilla.com> wrote: > BTW, the last version your head post gave, > > ```js > const ES6_PROXY = function(){ > > try { > new Proxy({},{}); > return true; > } catch(o_O) { > return false; > } > }(); > ``` Of course, the problem here is hardly specific to feature detection, or const, but simply an instance of the general annoyance induced by the old-school statement/expression separation. What you'd really want to write is something like ```js const ES6_PROXY = try new Proxy({}, {}), true catch (_) false; ``` For ES7 I would like to revive the do-expression proposal (hopefully at the next meeting), so that one can at least approximate the above with ```js const ES6_PROXY = do { try { new Proxy({}, {}); true } catch (_) { false } }; ``` Of course, semantically the function is equivalent, and a fine solution, if a bit verbose.