Hacker Newsnew | past | comments | ask | show | jobs | submit | royallthefourth's commentslogin

Oh, that'd just be a NewThing() constructor. The ThingFactory() can probably take an argument specifying which implementation you need. It's almost always just a small function holding a conditional chain that you don't want to copy/paste all over the place. As a bonus, it's a named design pattern that you can find in basically any book about design patterns.

Whether it's actually worth using is another question, but at least it's a point of reference.


> In fact, a few optimizations only work if you're using scalar types for parameters

This is the first time PHP has used typehints for optimization, isn't it? It was all safety checks prior to now. Looking forward to more of this!


The debugging slows the code down a ton in my experience, and it also prevents futures from running in parallel. Trying out the futures code from the guide, failing to disable debugging slows down the final Mandelbrot example by something like 100x on my machine.

Fortunately, DrRacket's friendly GUI makes it pretty easy to toggle debugging. I leave it in place most of the time, but occasionally the slowdown is just unbearable.


Thanks for the tips! I'd like to use ChezScheme, but haven't found a good way to get into it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: