Hi, thanks for this library!
I have noticed a fundamental difference between StableBuffer and the Buffer from the base library. StableBuffer stores [var x] while Buffer stores [var ?X]. This is a small difference but it makes a few things tricky.
Example:
initPresized: As a user, I would expect the method to initialize the buffer of given size when I call it. Instead, this method only updates the capacity and the actual allocation of buffer happens on first add. That's okay but slightly different from expectations. I believe it had to be done this way because we cannot initialize the buffer with all null. So we needed a default value as placeholder which was only available during add. Any method which needs a placeholder will be difficult to write in StableBuffer.
I am sure there is a reason for this. Could you please explain here or even better document it somewhere? Thanks!
Hi, thanks for this library!
I have noticed a fundamental difference between
StableBufferand theBufferfrom the base library.StableBufferstores[var x]whileBufferstores[var ?X]. This is a small difference but it makes a few things tricky.Example:
initPresized: As a user, I would expect the method to initialize the buffer of given size when I call it. Instead, this method only updates the capacity and the actual allocation of buffer happens on firstadd. That's okay but slightly different from expectations. I believe it had to be done this way because we cannot initialize the buffer with allnull. So we needed a default value as placeholder which was only available duringadd. Any method which needs a placeholder will be difficult to write inStableBuffer.I am sure there is a reason for this. Could you please explain here or even better document it somewhere? Thanks!