Skip to content
Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

How to print anything in C++ (part 2)

elbeno, 1 February, 201530 June, 2015

Part 1 Part 2 Part 3 Part 4 Part 5 Postscript We have a basic plan, and the ability to detect concrete types. But how can we detect whether an object supports output with operator<<? For this, there is a recently-discovered amazing trick. Here’s the code: template using void_t =…

How to print anything in C++ (part 1)

elbeno, 1 February, 201530 June, 2015

Part 1 Part 2 Part 3 Part 4 Part 5 Postscript I thought I’d have a go at writing some code that could print things. A pretty-printer, if you like. What I want to be able to do is this: // Print x correctly, where x is ANY type. cout

Holy Wars

elbeno, 26 January, 201526 January, 2015

All right, I have some opinions. Here are the definitive answers to the three most important dilemmas facing programmers today 🙂 * Static typing vs Dynamic typing Static typing. I suppose dynamic types are OK if you’re hacking together a small tool. But static (strong, preferably HM-inferred) typing allows you…

Do-notation can be misleading

elbeno, 13 August, 201430 June, 2015

Consider the following function: oddness :: Maybe Int oddness = do let a = Just 1 :: Maybe Int b >= \b -> return b And recall the definition of (>>=) for Maybe: instance Monad Maybe where (Just x) >>= k = k x Nothing >>= _ = Nothing So…

C++ Guru Question – followup

elbeno, 12 August, 201430 June, 2015

(following on from C++ Guru Question) There are a few reasons why the code before didn’t work: mainly a) C++ template argument deduction works one-way with a list of candidates, it’s not H-M type inference. b) A C++ lambda is a thing with some internal type, not a std::function (although…

C++ Guru Question

elbeno, 11 August, 201430 June, 2015

Wondering about this… template argument deduction succeeds for the explicitly-typed variable, fails in the auto case. (Also, it succeeds either way for an equivalently-typed unary operator template). template struct Foo { T m_t; }; template Foo operator/=(Foo foo, function fn) { return fn(foo.m_t); } void mystery() { auto foo =…

2013 Books

elbeno, 8 January, 20149 January, 2014

Books I read in 2013: Mr Penumbra’s 24 Hour Bookstore (Robin Sloane)I loved this book. A modern-day mystery story, set in San Francisco with all the tech hipsterism that implies, but also featuring old books, movable type and a secret society. Taking Sudoku Seriously (Jason Rosenhouse and Laura Taalman)This was…

Indiecade day 1

elbeno, 3 October, 20133 October, 2013

An excellent day of networking at Indiecade. Link dump time so I don’t forget these people… First was the guys from Rust presenting their experience making The Museum of the Microstar. Then I hung out in the rotunda meeting interesting folks, having thought-provoking discussions and playing some cool games. Chatted…

An Interesting C++ Technique

elbeno, 26 August, 201330 June, 2015

I recently discovered a C++ technique I haven’t seen recognized before in any books, articles, or mentioned online anywhere (search terms are difficult perhaps). For want of a better name I call it Structural Capture. Consider the following code: #include #include using namespace std; //————————————————————— struct Foo { template Foo(const…

The Year in Books

elbeno, 16 December, 201227 December, 2012

Books I’ve read this year: Drive: The Surprising Truth About What Motivates Us (Daniel H Pink)I started the year by finishing this book. I was rather late to the party in reading it; it’s practically received wisdom now, especially for managers of knowledge workers. And of course there is a…

  • Previous
  • 1
  • …
  • 7
  • 8
  • 9
  • …
  • 69
  • Next
©2026 Why is a raven like a writing desk? | WordPress Theme by SuperbThemes