Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Ranges
In 4.8 it will be possible to use range notations to represent consecutive (mainly numeric) values. For example, you could set Article image
field to 2-6, 8
as a shortcut for 2,3,4,5,6,8
. This notation is fine for positive values, but is problematic for negative ones: -6--1
looks ugly and is difficult to parse.
What symbol could possibly replace -
in ranges? I use ..
in some plugins: would -6..-1
or -6...-1
be ok?
Offline
Re: Ranges
Double or triple dot works for me. Double if we can get away with it… means fewer characters in our limited-width database fields.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Ranges
The hyphen as an indicator is very intuitive of course. Would an additional space (required) before and after the hyphen be possible? You would get something like -2 - -6
for a range between -2
and -6-
.
CSS for instance forces the use of spaces before/after the hyphen, e.g. for calc()
and other functions, precisely to remove any possible ambiguity with negative integers.
Otherwise, triple period would work too. Hmm, triple is more complicated to input actually, iOS and macOS tend to automatically transform or substitute it to … (horizontal ellipsis), fwiw.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Ranges
What about the |
symbol?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Ranges
Bloke wrote #320153:
Double or triple dot works for me. Double if we can get away with it… means fewer characters in our limited-width database fields.
Be mindful of confusion between ...
and …
– especially where the browser or editor may substitute the former for the latter.
Offline
Re: Ranges
Yeah, double dot is better, imo.
phiw13 wrote #320161:
Would an additional space (required) before and after the hyphen be possible?
That still takes up 3 characters and is subject to head-scratching (“why is it not working with 6- 13
”?!) Plus it still looks odd even with the space when using negative numbers.
Since this is most likely to be used in fields with limited capacity (255 chars max) I vote for the shortest number of chars we can get away with that still conveys the meaning of something is missing where these characters are.
In terms of English usage, ellipses are used in quotations to indicate “missing” content (and also to indicate trailing-off thoughts). There is a sort-of analogue there, but as phiw13 and gaekwad point out, can be auto-corrected from three dots to ellipses, which could cause no end of confusion.
colak wrote #320164:
What about the
|
symbol?
Hmmm. We have traditionally used that for separating things, and it’s a common device for lists so I’d rather not use it, as it creates an exception to a well-established convention.
all
Just playing devil’s advocate here, but have we got any concrete use cases in mind where we, or someone using Textpattern, might legitimately use ranges with negative numbers? I know it’s a horrible syntax to look at -1--6
but if the number of times it’s going to be used are in the next-to-none range, is it an acceptable trade-off?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Ranges
etc wrote #320151:
This notation is fine for positive values, but is problematic for negative ones:
-6--1
looks ugly and is difficult to parse.
Out of curiosity: what’s a real-world example of a negative range in Textpattern terms? Bullet point is fine, I’m clearly missing something obvious.
Offline
Re: Ranges
Anything useful here?: en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
Offline
Re: Ranges
gaekwad wrote #320169:
Out of curiosity: what’s a real-world example of a negative range in Textpattern terms?
Snap! :)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Re: Ranges
Good find, Pete. I actually quite like the square-bracket notation, even though it is up to three extra chars.
12, 14, 5, [42, 48], 73, [-1,-6]
Encapsulated, and permits an optional space after the comma as well, if you have the capacity in your field to use it (although the lack of space does make it more visually distinct). Plus it’s fairly easy to parse.
Is it intuitive enough? Thoughts?
Last edited by Bloke (2019-11-21 10:26:20)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Ranges
gaekwad wrote #320172:
I must be half asleep. Did you sneak in a ninja edit or did I miss that last sentence?
Hehe, no ninja edit (for a change!)
Köffee? :)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline