On 04/06/2009, at 3:46 PM, H. Langos wrote: > 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).
This should be left as a comment on the relevant revision in CodeReview. Note that it's likely irrelevant anyway, as, in all likelihood, the merge of String and Parser Functions will be reverted. -- Andrew Garrett Contract Developer, Wikimedia Foundation agarr...@wikimedia.org http://werdn.us _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l