And there’s not much of that mental overhead anyway for this kind of thing! As you can see in the actual code, I make free and liberal use of expect for this kind of tool. ![]() I’m basically at the point where if I need a small command-line tool, I write it in Rust, not in a conventional scripting language like Python, because the benefits I get more than outweigh whatever small extra amount of mental overhead there is. I’d love to hear about similar capabilities in other languages!) (The only thing I know of that’s playing the same game is F ♯ type-providers. Being able to slap # on a struct and a couple attributes on struct fields and having it Just Work™ to deserialize XML into local types is mind-blowing. Rust’s compiler just helps you out so much along the way, not only with the type-checking but with the really amazing metaprogramming capabilities you get with it. For context: I’ve taken multiple passes at this in Python-which in the way people normally think about these things should be way easier-and I’ve failed both times. I built this functioning little “script” in about two hours. (Like include the creation and modification timestamps in the header, for example.) But all of those things would be very straightforward to do. There’s a lot this little library doesn’t do. enex XML format) to Markdown files with YAML metadata headers-mostly just to see how quickly and effectively I could do it, because I’ve never actually had an excuse to use Serde and I thought this might be a nice spot to try it. I built a little tool in Rust to convert Evernote exports (in their custom. One of them is the kind of thing I proved out to myself today-again, because I’ve had this experience before, albeit not with anything quite this “complicated.”
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |