Thanks for the tutorial. I have though one question. Is there a particular reason for declaring S4 function inside the guidGenerator and not outside of it?
Every time one calls guidGenerator, S4 gets declared again.
S4() inside guidGenerator(), is just a personal choice of abstraction. guidGenerator() is only called when a new Todo object is created; and an extra function allocation for every new Todo object, doesn't have any observable performance overhead whatsoever, for us to worry about the "abstraction-optimization" tradeoff. :)