2010/3/28 Conrad Irwin <[email protected]>:
> The "::key" function seems to just be noise, could the current "third"
> parameter be moved to the front.
>
> Message::parse( 'welcome-to' )->params( $wgSitename );
>
Not really. The call to parse() actually triggers the parsing. With a
call chain like this, the object has to either magically know when the
call chain ends, or continually reparse stuff.

> I suppose it's possible that someone might want to render the same
> message with the same parameters in several ways, but I can't think of
> many use-cases.
>
> With any code like this I worry that someone might try:
>
>  $msg = Message::key( 'example' );
>  $nicemsg = $msg->params( 'nice' );
>  $nastymsg = $msg->params( 'nasty' );
>  echo $nicemsg->text();
>  echo $nastymsg->text();
>
> Which will break unexpectedly, but perhaps that is livable with.
>
This won't do what you expect, true. We should probably warn against
this in the docs and recommend that chains be used whenever feasible.
Coders who know why this fails and want similar functionality anyway
can use clone.

> The current documentation uses {{-transformation a lot, which is hard to
> pronounce - is it just parsing, or something else?
>
"Brace-transformation"? It's really just preprocessing, i.e. the
expansion of magic words and other stuff in {{braces}}.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to