On Thu, Jun 04, 2009 at 03:55:38PM +0200, H. Langos wrote:
> Seems like (at least) the API of #pos in ParserFunctions is
> different from the one in StringFunctions.
>
> {{#pos: haysack|needle|offset}}
>
> While the StringFunctions #pos in MediaWiki 1.14 returned an
> empty string when the needle was not found, the ParserFunctions
> implementation of #pos in svn now returns -1.
>
I forgot to ask THE question. Is it a bug or is there some good reason
to break backward compatibility?
And no, programming language cosmetics is not a good reason. :-)
If something has the same interface, it should have the same behaviour.
If the old semantics was too awful to bare, the new one should have been
called #strpos or #fpos (for forward-#pos. #rpos always had the
"-1 return on no-found" behaviour).
cheers
-henrik
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l