Page MenuHomePhabricator

Allow to store extension data in PPFrame
Open, Needs TriagePublic

Description

In the past, it was a common pattern to set custom member variables to objects you wanted to associate extension data with. The Parser object is/was used esspecially often.

However, this is bad style and is complained about by Phan. For the Parser use case, we introduced ParserOutput->setExtensionData(). Why don't we introduce the same thing for PPFrame? PPFrame is an object essentially resembling a transcluded template while parsing (although this doesn't seem to be documented anywhere, yay). It holds data about template arguments etc. Adding a store for extension data here as well would allow extensions to store template scoped information analogous to arguments, but it would be possible to write to them as well. Otherwise, they have to fallback to unsafe approaches as outlined before.

A case where this is useful would be, for example:

Event Timeline

MGChecker triaged this task as Normal priority.Oct 25 2018, 9:00 PM
MGChecker created this task.
MGChecker raised the priority of this task from Normal to Needs Triage.Oct 25 2018, 9:11 PM
MGChecker added a project: Parsing-Team.

As I understand it, the Parsing-Team might play a role in deciding if this is done or not.

Implementing it, isn't the problem, I think I can do it.

I might misunderstand something here and this is just unafe for Parser due to suspension states, cloning etc. If this is the case, please just point this out to me.