From: John M. S. <sk...@oz...> - 2003-06-11 14:35:48
|
Brian Hurt wrote: > On Wed, 11 Jun 2003, John Max Skaller wrote: > I only know of one API question at this point: things that might change > (go away): and that's precise/imprecise actions in psqueue. Currently > there are two sets of operations: find, adjust, add, and remove, which > throw an exception on "unexpected" conditions (adding a key that already > exists, removing a key which doesn't, etc), and query, update, insert, and > delete, which do something "intelligent" in those costs (adding a key that > already exists becomes an update, removing a key that doesn't exist does > nothing, etc). Now, my preference would be to pick one of the two sets > and run with it- but I don't know which one. Feedback would be > appreciated here. I'm afraid my comments won't help much .. but I'll make them anyhow. I use Hashtbl, and until recently only the basic functions. Now, sometimes, it does more than I want, for example, I've never use the pushdown stack of entries feature. So for me, the 'add' function is actually a pain, since I have to first check if a key is present to avoid duplicates. Similarly, sometimes I just want to either add or replace, and I had to write code to do that. Since I found 'replace' was added, I'm using that now. Its equivalent to 'add if not present otherwise update', which is easy enough to code, but I get a feeling the built-in update is more efficient, and I can check its semantics in the manual, rather than search my own code. So .. I wouldn't do without the raw primitives: they're the routines which form a basis, and which are expected to be fast. But some of the composite routines are also useful and perhaps more likely to be what is needed in many cases. So I'd probably include *both* the axioms and the theorems, without going overboard: include the extra stuff if it's likely to be heavily used OR allows for more efficient processing OR would be hard to code. Hmmm .. meaning: enrich the basic interface but not *too* much. You can always add in the extra routines later if someone complains, but you want the interface to be ready to use without needing a whole lot of client written auxilliaries. Which I think leaves you just as uncertain as before :-) -- John Max Skaller, mailto:sk...@oz... snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 |