On Thu, Jun 04, 2009 at 05:05:50PM +0100, Andrew Garrett wrote:
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.
Sorry to bother you but I am not a wikimedia developer so I wouldn't know where to start looking.
Could you point me to the right place/list/article? The svn revision with the String and Parser Functions merge was 50997.
cheers -henrik