Yes. The composition and transform algorithms currently don't guard against their inputs being nonsensical operations. When the composition algorithm was written, we were for the most part only using composition in places where the operations were already expected to be valid, so we didn't ascribe a high priority to implementing proper checking within the composition algorithm itself since it would only have increased the cost of composition by doing redundant checks (but we did regardless leave a TODO to put in proper validity checking since it seemed like a good idea to have it eventually anyway).
Best regards, Alex On 11/22/09, Tad Glines <[email protected]> wrote: > > I was doing some testing to validate my understanding of composition > when I ran into a case that (I assumed) shouldn't succeed and should > instead throw an exception. > > Here's the code: > DocOpBuilder docOp = new DocOpBuilder(); > docOp.characters("ABCDEF"); > BufferedDocOp doc = docOp.build(); > > System.out.println(doc.toString()); // Prints: ++"ABCDEF"; > > DocOpCollector col = new DocOpCollector(); > > docOp = new DocOpBuilder(); > docOp.retain(1); > docOp.deleteCharacters("B"); > docOp.retain(4); > col.add(docOp.build()); > > docOp = new DocOpBuilder(); > docOp.retain(2); > docOp.deleteCharacters("C"); > docOp.retain(3); > col.add(docOp.build()); > > doc = Composer.compose(doc, col.composeAll()); > System.out.println(doc.toString()); // Prints: ++"ACEF"; > > When I wrote this I assumed that it would fail on the second to last > line, but instead it succeeds. > > Does this just represent one of the cases where stricter operation > validation hasn't been implemented yet? > Similar naive (un-transformed) compositions involving > deleteElementStart() and updateAttributes() do fail with an exception. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Wave Protocol" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/wave-protocol?hl=en -~----------~----~----~----~------~----~------~--~---
