When I request segment fully or partially outside the input text parameter instead of returning existing part (or empty) it raises uncatch'able error. It is so different than any language I know that I consider it bug or at least improvement candidate.
Rationale:
- It can be cheaply imemented in library once (dry)
- It requires lot of ugly and old-fashioned if-thens on every use instance in every app from every developer made further complicated by modest text function set (anti-dry)
- It is not logical as 2-element subset of empty set is a perfectly valid empty set and most (all?) other languages to it that way
E.g.: fragment ("key",2,5) = "ey", fragment ("key",5,5)="", fragment ("",1,5)="".
@ewpatton do you think there is a chance for a fix ?