Difference between revisions of "Talk:Separate Words"

From Second Life Wiki
Jump to navigation Jump to search
(propose radically simplifying by dividing this one article into two, one focused on spacers, one focused on separators)
m (strike the talk obsoleted by revising SeparateWords to factor out keepSpacers and discardSeparators)
 
Line 1: Line 1:
== Divide This Article In Two ==
We could/ should/ soon will/ might not divide this one function into two functions, maybe even also dividing this one article into two articles:
<pre>
list spaceWords(list words, list spacers)
{
        ...
}
list separateWords(list words, list separators)
{
        ...
}
</pre>
That approach defeats the max 8 limit on spacers and separators without tangling with the mess that is the "Spacers vs. Separators Contradictions" issue discussed below.
== LSLEditorBugs ==
LSLEditor 2.15 and Second Life 2007-09-12 disagree over this [[Separate_Words|Separate Words]] example, says [[LSLEditorBugs]].
== Spacers vs. Separators Contradictions ==
== Spacers vs. Separators Contradictions ==


Line 29: Line 8:


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.
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'''
'''Experiment'''


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


'''Specification'''
'''Specification'''


We have no specification for this test case.
As yet we have no specification for these test cases.


Our only sources for specification come up empty:
Our only sources for specification come up empty:


A.175. llParseString2List of the 2007-08-01 "Linden Scripting Language Guide.html" does not discuss this test case.
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 this test case.
The [[llParseString2List]] article of this LSL wiki does not discuss these test cases.


'''Design'''
'''Design'''
Line 54: Line 35:
'''Implementation'''
'''Implementation'''


Maybe we should tweak the separateWords example to complain, via llOwnerSay, any time the programmer does violate this precondition.
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.
Maybe we should tweak the separateWords example to produce the effect of spacer when the same string appears in both lists.
Maybe we should add examples to show concretely how dramatically simpler and shorter the code becomes when there 0 separators together with more than 8 spacers, or 0 spacers together with more than 8 separators.


'''Documentation'''
'''Documentation'''


We've edited the [[llParseString2List]] and [[Separate Words]] articles to remind the programmer to work to avoid violating this precondition.
We've edited the [[llParseString2List]] and [[Separate Words]] articles to remind the programmer to work to avoid violating this precondition.
Our English was: To avoid contradiction, every string of the '''{{LSL Param|spacers}}''' list of strings to keep must not exist in the '''{{LSL Param|separators}}''' list of strings to discard.
We should edit these articles to caution further, when we're doc'ing code that does not to produce the effect of a spacer for a string that is both separator and spacer.

Latest revision as of 19:12, 27 September 2007

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.