Are there cases where a typedef is absolutely necessary?

Ah, I just remembered the identity meta-function. It is possible to write operator typename identity<void (Testable::*)() const>::type() const; with the following definition of identity: template <typename T> struct identity { typedef T type; }; You could argue that identity still uses a typedef, but this solution is “good” enough for me.

Is there a JavaScript idiom to change “undefined” to “null”?

Javascript now supports a null-coalescing operator: ??. It may not be production-ready (consult the support table), but it’s certainly safe to use with Node or a transpiler (TypeScript, Babel, etc.). Per MDN, The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or … Read more

In Ruby, how does coerce() actually work?

Short answer: check out how Matrix is doing it. The idea is that coerce returns [equivalent_something, equivalent_self], where equivalent_something is an object basically equivalent to something but that knows how to do operations on your Point class. In the Matrix lib, we construct a Matrix::Scalar from any Numeric object, and that class knows how to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)