Visruth Srimath Kandali

BigNum and S7

BigNum

I’ll write a little here, but the readme goes into more detail.

I’ve been working on a package designed to explain and provide examples for S7, R’s newest OOP system. I’m a massive fan, and have been using S7 whenever I can. I translated a few Tidyverse S3 constructs to S7 in the past few months, and have learnt a lot about OOP in R because of that. I wanted to codify my knowledge (mostly so I have a reference myself), so I decided to write a package displaying S7’s prowess and elegance.

BigNum is designed to be a package you tear open and look at–one where you spend more time looking at source than interacting with the (rather barebones) API. The code itself is simple, implementing limited infinite precision arithmetic using linked lists. The actual things you can do with the objects exported by the package are limited–but the inner workings hold pedagogical value I hope. I wrote a vignette which should introduce you to S7 from the ground up and hopefully leaves you knowing enough to be dangerous, and to understand how the package works. I want the package to be a worked out example of how to use S7 in a package context, and to keep up to date with styling/design patterns/etc. as they are developed for S7.

I’m not ready to fully release the package (into 2.0.0–to match in part {S7}’s semver) I don’t think–I’m missing some tests for S7, and have no tests for S3 and S4 (submit a PR!). Also, I’m still thinking about littering the source with comments explaining why I do certain S7 things–the algorithms themselves are rather simple and irrelevant, but I want to highlight some syntax and patterns S7 uses. I’ve done this in part through the vignette, but the vignette is rather slow and is designed for a ground up introduction of S7. I think there’s merit to highlighting some of those ideas in source itself.

I also need thorough vetting of all the code–the pedagogical purpose I purport is practically useless if the code itself isn’t top class. The more eyes on my code, the merrier, so I’ve decided I’ll build in public from now on–please take a look!

I hope the package convinces you to consider using S7 the next time you need OOP in R :)