Talk:Separate Words

From Second Life Wiki
Jump to navigation Jump to search

Spacers vs. Separators Contradictions

This is going to return the wrong answer when there are inclusive or total collisions between separators and spacers. -- Strife Onizuka 09:32, 12 September 2007 (PDT)

Thought-provoking, thank you, I've responded inline below. -- Ppaatt Lynagh 05:11, 13 September 2007 (PDT)

Context

We mean to be discussing the astonishing test case of including the same string in both the separators list of strings to keep and yet contradictorily also in the spacers list of strings to discard.

Similarly astonishing test cases include listing a separator or spacer more than once, listing a separator that contains a spacer, or listing a spacer that contains a separator.

Experiment

We should make time to experiment with these test cases, sampling how llParseString2List responds to these cases in world in Second Life.

Specification

As yet we have no specification for these test cases.

Our only sources for specification come up empty:

A.175. llParseString2List of the 2007-08-01 "Linden Scripting Language Guide.html" does not discuss these test cases.

The llParseString2List article of this LSL wiki does not discuss these test cases.

Design

We should have designed the llParseString2List function to avoid astonishing the programmer, in this test case as with any test case.

Least astonishing might be for any string found in both lists to have no effect, or have the effect of a spacer, or have the effect of a separator.

We should specify the effect of a spacer, because people testing code are more likely to notice the keep effect of a spacer, rather than the discard effect of a separator, or the null effect you get when you omit a string from both lists.

Implementation

Maybe we should tweak the separateWords example to complain, via llOwnerSay, any time the programmer calling the separateWords function violates a precondition.

Maybe we should tweak the separateWords example to produce the effect of spacer when the same string appears in both lists.

Documentation

We've edited the llParseString2List and Separate Words articles to remind the programmer to work to avoid violating this precondition.