Why Rust's ownership/borrowing is hard

11.02.2016

Rust

Working with pure functions is simple: you pass arguments, you get a result — no side effects happen. If, on the other hand, a function does have side effects, like mutating its arguments or global objects, it's harder to reason about. But we've got used to those too: if you ...

ijson in Rust: typed lexer

11.11.2015

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 ...

ijson in Rust: errors

26.08.2015

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 ...

ijson in Rust: object builder

09.07.2015

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

28.05.2015

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

21.05.2015

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 ...

ijson in Rust

15.04.2015

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 ...