"lineAtOffset"?
Richard Gaskin
ambassador at fourthworld.com
Thu Oct 29 15:33:30 EDT 2015
J. Landman Gay wrote:
> On 10/29/2015 12:37 PM, Richard Gaskin wrote:
>> Bob Sneidar wrote:
>>
>> > So my gut feeling is, for smaller strings the time it takes is
>> > really inconsequential. For larger strings it seems like adding
>> > an argument to the existing function to designate what data you
>> > want returned would suffice.
>>
>> What would that syntax look like?
>
> I sort of like this idea. There could be an extra parameter in the
> lineOffset function:
>
> get lineOffset("foo",tText,"text")
>
> The third parameter could be either "text" or "number". If the third
> param is missing, or if it's "number", then we get the number back as
> we do now. If it's "text" we get the text value. That retains
> backward compatibility.
>
> "Text" and "number" are just suggestions; the actual words could be
> anything that describes the values appropriately.
I like the compactness, but have mixed feelings about the semantics.
When the third arg is an integer it specifies a starting offset, but
when the third arg is the string "text" it specifies the return value type.
In addition to mixing purposes, what would we do if we want to return
text but also specify a starting offset?
We might consider using a fourth argument for return type and leave the
third for starting offset, but given how frequently offset is used
without a specified start I'd guess most of the time it'd just be an
empty arg:
get lineoffset("foo", tText,"","text")
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list