News for hackers. Stuff that matters.
Re:Write More Classes by barrkel on Tuesday February 12, 2013 @02:18AM (#5205636)
From what you wrote, I'm not sure you read the article. It's not about objects vs functions; it's about hiding a lot of functionality behind an overly-simple interface, with particular attention paid to an example of a parser that takes a whole string rather than a streaming interface.

What annoyed me most was his constant apparent conflation between bytes and characters. But I didn't really see much evidence of treating all the world like a nail.

Re:Write More Classes by Locke1689 on Tuesday February 12, 2013 @03:16AM (#5205759)
I know what he was trying to say, but I don't think that's actually what he said.

What he should have said is that you should pick an interface that suits your computation. The problem was not that the interface was too simple, but that it didn't fit the computation. One can easily imagine an object-oriented interface for the same wrapper computation that also hides the true nature of the computation.

Re:Write More Classes by lucian1900 on Tuesday February 12, 2013 @04:17AM (#5205897)
I saw no conflation. Everything there is a byte.
Re:Write More Classes by barrkel on Tuesday February 12, 2013 @02:34PM (#5208919)
Quote:

For instance while I have not yet reached the end of the string I would feed my characters into a buffer until I found the end of the string

The point however is that instead of reading characters step by step some lexers will instead have a look at a buffer of a certain size and move a pointer around in that buffer and modify some bytes in place (in-situ).

He talks about this buffer, at one moment in terms of bytes, another moment in terms of characters.

It's a pedantic quibble, but an easy source of errors, especially if you're using a language that doesn't distinguish strongly between the two concepts, and e.g. you encode your characters as UTF8 with a weak alias to unsigned char just like bytes.