HNHacker News
TopNewBestAskShowJobs

bnjmn

477 karma · joined July 6, 2011

[ my public key: https://keybase.io/benjamn; my proof: https://keybase.io/benjamn/sigs/94-u377AG0oTnRb3A88rmP2WOk88eq9DrT9K2RGfsJk ]
submissionscomments
bnjmn··on Motion-triggered RGB LEDs you can attach to any pair of shoes
Custom-fabricated Teensyduino w/ accelerometer that can distinguish heel/toe impact, USB power (battery clips onto shoelaces), LEDs attach to shoes with velcro. Cycle through preprogrammed light patterns by cycling power.

You may have seen shoes like this before, but these are much easier to tinker with, if you're into that. We're not advertising the kit as programmable, but I'm sure the HN crowd will figure out how to hack it.

On a personal note, there's no big (or small) company behind this project. A group of friends launched it primarily to help sustain our growing Burning Man camp. This is our first foray into manufacturing electronics at any kind of scale, so any help you can provide the project will really make a difference!

https://www.kickstarter.com/projects/1161431643/blinkyshoes

bnjmn··on A maths question for Singapore schoolkids
Thanks for taking a swing at this rebuttal, but isn't "gentlemen" a touch, um, gendered?
bnjmn··on Let’s get serious about ES6 generator functions
It means you can have generator functions that contain no yield statements, which is not as crazy as it sounds. I've had to do `if False: yield` before in Python to trick the language into treating a function as a generator. An unyielding generator behaves so differently from a similar-looking non-generator function that the extra syntax seems more than appropriate to me.

The asterisk also makes it trivial (using regular expressions) to tell whether a string of code contains any generator functions.

"Explicit is better than implicit" is a rule of thumb that Python supposedly values, but neglects to follow here!

bnjmn··on Let’s get serious about ES6 generator functions
This is hand-wavy for sure, but I don't think Emitter.prototype.emit is called more than once per AST node, and the number of cases should be less than the number of calls to .emit, so there should be fewer cases than AST nodes (which is a statically knowable number).
bnjmn··on Let’s get serious about ES6 generator functions
You can pass a value to .next(), which provides most of the value of .send().
bnjmn··on Let’s get serious about ES6 generator functions
Really agree with this. I've come to appreciate both the limitations and power of generators during the course of this project.
bnjmn··on Let’s get serious about ES6 generator functions
Interesting suggestion. Although Traceur's generator support is arguably more limited, I have to admit their code is currently better tested than regenerator's, so I think I want to give this repo some time to mature before exploring whether the Traceur team wants to use it.
bnjmn··on Let’s get serious about ES6 generator functions
Thanks for the links! I hope regenerator can make those projects work in environments beyond node.js.
bnjmn··on Let’s get serious about ES6 generator functions
I love Continuum, and I think it takes the right approach for implementing all of ES6, if that's what you want. I just didn't think I could pitch the idea of using a virtual virtual machine to my team, so I took the more conservative approach.
bnjmn··on Let’s get serious about ES6 generator functions
I might recommend against the additional complexity for most use cases, since the generated code is only 1.5x slower, but I fully expect/hope that Facebook will decide to bite that complexity bullet for the speed gains in newer browsers. Betting on the future of JS is very much the ethos here.
bnjmn··on Let’s get serious about ES6 generator functions
Exactly, the `wrapGenerator` function provides a small runtime that (among other things) handles uncaught exceptions: https://github.com/facebook/regenerator/blob/master/runtime/...
bnjmn··on Let’s get serious about ES6 generator functions
I'm hoping to do a more in-depth writeup about this soon, but the basic approach is to hoist all declarations up into the closure of an inner function, so that all variables in the scope of the function persist between .next calls, and then convert any control structures that contain yields to a big switch statement, where the cases are essentially jump targets, controlled by the $ctx.next property.
bnjmn··on Let’s get serious about ES6 generator functions
Done! Thanks! https://github.com/facebook/regenerator/commit/fe42c74a486fb...
bnjmn··on Let’s get serious about ES6 generator functions
Not just yet, but that's on the roadmap for sure: https://github.com/facebook/regenerator/issues/18
bnjmn··on Let’s get serious about ES6 generator functions
Re: how hard, I've been working on it for... a while ;) https://twitter.com/benjamn/status/331923303767867392

Re: unforeseen edge cases, I'd love to see any failing pull requests for the test suite: https://github.com/facebook/regenerator/blob/master/test/tes...

bnjmn··on Let’s get serious about ES6 generator functions
Great idea. Issue filed: https://github.com/facebook/regenerator/issues/20
bnjmn··on Let’s get serious about ES6 generator functions
Thanks! Please let me know if/how you end up using it!
bnjmn··on Let’s get serious about ES6 generator functions
Primary author here. Ask me anything!
← PreviousPage 3 of 3