ijson in Rust: typed lexer


ijson in Rust, Rust

Catching up on my Rust learning diaries… Today I'm going to tell you about releaving my Lexer from its Pythonic legacy and what tangible results it produced, beside just being The Right Thing™. Basic idea The original lexer yielded three kinds of lexemes: strings enclosed in quotes: "..." multi-character literals ...

Cadence for highlight.js


My software

We're now doing releases of highlight.js on a cadence of 6 weeks. The latest release 8.8 was the second in a row (which is what technically allows me to write "are now doing"). The reason for that is we (well, mostly me) had a certain difficulty deciding when to actually ...

ijson in Rust: errors


ijson in Rust, Rust

While I fully expected to have difficulty switching from the paradigm of raising and catching exception to checking return values, I wasn't ready to Rust requiring so much code to implement it properly (i.e., by the bible). So this is the one where I complain… Non-complaint I won't be talking ...

Versioning REST: another angle


Web, Software design

I've got an interesting comment on "Versioning REST APIs" that boils down to these points: Sometimes you can't really afford breaking clients (ever, or long enough to make no matter). A global version allows to freeze an old code base and have new implementation to be completely independent. This is ...

Versioning: follow-up


Web, Software design

After reading a few comments on reddit and by email about my post on versioning of REST APIs I see that I wasn't clear on terminology and have left out some context. That's okay! Overthinking details is the main killer of all my interesting thoughts :-) I'd rather post more ...

Versioning of REST APIs


Web, Software design

Don't version APIs, version resources. I.e., this is wrong: https://example.com/api/v1/resource Global version number has a few problems: A backwards incompatible change to any one resource invalidates all clients, even those who don't use this particular resource. This is unnecessary maintenance burden on client developers. It constrains development on the server ...

ijson in Rust: object builder


ijson in Rust, Rust

Object builder is what makes a parser actually useful: it takes a sequence of raw parser events and creates strings, numbers, arrays, maps, etc. With this, ijson is functionally complete. Filtering Ijson can filter parser events based on a path down JSON hierarchy. For example, in a file like this: ...

ijson in Rust: unescape


ijson in Rust, Rust

Today marks a milestone: with implementation of string unescaping my json parser actually produces entirely correct output! Which doesn't necessarily mean it's easy to use or particularly fast yet. But one step at a time :-) The code came out rather small, here's the whole function (source): fn unescape(s: &str) ...

ijson in Rust: the parser


ijson in Rust, Rust

It took me a while but I've finally implemented a working parser on top of the lexer in my little Rust learning project. I learned a lot and feel much more comfortable with the language by now. In the meantime I even managed to get out to a Rust Seattle ...

Styles unification: first results


My software

Yesterday I gathered some willpower and began working on a long awaited (by myself, at the least) style unification in highlight.js. Here's the first taste of why I think it is important. Let's take one of the recently added style — the "Android Studio" — and see how it displays ...

ijson in Rust


ijson in Rust, Rust

I had this idea for a while to learn a few modern languages by porting my iterative JSON parser written in Python as a test case. It only makes sense because, unlike most tutorials, it provides you with a real real-world problem and in the end you might also get ...

Problem with JSON encoding


Web, Software design

JSON spec says that a UTF shall be used to encode it as a byte stream (with a strong preference to UTF-8). However it also allows characters to be encoded in the form of \uXXXX. This poses a problem on the parser implementation side: You have to decode a byte ...

I learned C# in 4 days!

You know those crazy books, "Learn whatever programming in 21 days"? I mean, who can afford spending that much time, right? Some background I have a friend who employs a very particular workflow for dealing with his digital photos. It often involves renaming and merging files from different cameras into ...