6

Is there a verb for replacing placeholder values with actual values in a template?

For example:

The verb for transforming "Hello FirstName LastName" to "Hello John Smith".

7
  • 5
    One possibility is to say you populate the template Commented Dec 15, 2015 at 13:25
  • @FumbleFingers You might consider converting this to an answer, especially given that neither of the alternatives has managed to garner a positive balance. While I personally prefer instantiate conceptually, I think populate is the more common and better understood term for this particular usage. Commented Dec 16, 2015 at 16:09
  • @Chris: Given your profile says you've got a background in programming (as have I), I'm surprised you prefer instantiate for OP's context. I'd see that as what happens when you create an instance of a template class (through an implicit or explicit call to its "new" constructor). In most cases no "value replacement" would take place until some later point when you call a method giving it a data source containing the values to be replaced - which method I would be likely to call populate(), rather than instantiate(). Commented Dec 16, 2015 at 16:17
  • @FumbleFingers I've already covered my reasoning ad nauseam in the comments to that answer. However, populate is probably a better choice --one I would upvote if you had made it an actual answer. Commented Dec 16, 2015 at 16:39
  • @Chris: Sorry - I should have clicked on Show more comments below. To be honest, I never really became expert in using template classes (having developed my own idiosyncratic techniques long before it was even practical to implement such things in most programming contexts). So I can't claim any special knowledge re the IT context, and it's not 100% certain OP is specifically focused on that context anyway. But your point is well made, so given the current state of the votes I'll do as you suggest. Commented Dec 16, 2015 at 16:50

7 Answers 7

5

One possibility is you populate the template (that's over 1000 written instances in Google Books).

Note that this use of populate is a bit "geeky", and thus likely to be restricted to software contexts. For more general contexts, it's worth noting that Google Books has nearly 9 times more instances of fill in the template.

1

I think you can use substituted. I derive this from @deadrat's comments above - "The OP's situation seems to call for 'parameter substitution.'"

Meaning

use or add in place of/replace

Google

In your case,

The placeholders, firstName and lastName were substituted with the actual values "John" and "Smith" respectively.

1

When referring to a template as a whole:

"Populate the template" "Fill in the template"

Here, the word 'template' should provide some context about there being placeholders that are being replaced.

However, if the verb is used without the word template in the context, it is not as clear that only specific placeholder part is being replaced:

"Populate first name" "Fill in first name"

In such a case, the word 'emplace' might be better: "Emplace first name"

Or maybe 'embed'?

0

The verb is

to instantiate

meaning to represent something by an instance. The act of instantiating is an instantiation:

the representation of (an abstraction) by a concrete example (logic)

or

the process of deriving an individual statement from a general one by replacing the variable with a name or other referring expression

8
  • 5
    If the context is programming, then instantiation refers to the creation of an object according to a particular defined type. The OP's situation seems to call for "parameter substitution."
    – deadrat
    Commented Dec 15, 2015 at 13:48
  • 2
    The entry expected from the user is something that fits the type "Hello FirstName LastName" . Hello firstname is an abstraction of the type of values expected and the definition fits exactly "the representation of (an abstraction) by a concrete example". It's not a programming question as such. I mean the form could a piece of paper.
    – P. O.
    Commented Dec 15, 2015 at 13:59
  • 2
    @deadrat I disagree. Even by analogy to programming, instantiation is entirely correct and apt. You are taking a general type (the template) and creating a specific instance of it. That's exactly why we use the term in programming. Commented Dec 15, 2015 at 14:19
  • 2
    @ChrisSunami Look, I don't want to turn into That Internet Guy Who Has to Have the Last Word On Everything (and I don't know who "we" is here), but in programming, templates aren't lists of types; they're lists of names. Instantiation is a term of art for making an object out of a class. I'm done here except to note that I am not a downvoter.
    – deadrat
    Commented Dec 15, 2015 at 14:39
  • 2
    @deadrat I'm also a professional programmer, I'm well aware of the term's technical use. However, the point is that the term predates modern programming. The reason we use it in programming is because of its original meaning. Just because a word gains a specialized usage in a field doesn't mean it loses its original meaning. Commented Dec 15, 2015 at 14:53
0

Interpolate

In computer programming, string interpolation (or variable interpolation, variable substitution, or variable expansion) is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced with their corresponding values.

0

I see there's some argument about whether the correct term is "instantiate" or "populate". I would humbly suggest the correct answer is: neither.

In common English, there is no single word that is widely recognized as meaning this. If you want to be clear, you would have to use a phrase or a whole sentence. Like, "Replace the place holders with specific values."

In IT ... "instantiate" simply does not mean this. Instantiate means to create an instance of an object. If you were talking about templates, we might well understand instantiate to mean to create an instance of the template. That might or might not include specifying values for variables. It would not normally be understood to mean parsing the template and replacing place holders with instance values. Maybe, possibly, the code to display or print the document would automagically pick up instance variables and substitute them in the right places. Or maybe not.

"Populate" is a pretty general term. Supplying values to be used to fill in the template could be referred to as "populating the object". But again, we wouldn't normally understand this to include parsing the template and substituting values.

If I was writing a program to do this, and the project leader told me, "Write a function to instantiate the template", I certainly would not interpret that to mean substituting for the place holders. I'd take that to mean writing a constructor, and/or the code to call the constructor.

For example, the JavaScript programming language includes "template strings" that function much like you describe. Mozilla, the people who wrote Firefox, describe this process like this:

Along with having normal strings, template literals can also contain other parts called placeholders, which are embedded expressions delimited by a dollar sign and curly braces: ${expression}. The strings and placeholders get passed to a function — either a default function, or a function you supply. The default function (when you don't supply your own) just performs string interpolation to do substitution of the placeholders and then concatenate the parts into a single string.

They then take about two pages to describe "string interpolation". My point being, they don't just say, "the string is instantiated" or "the string is populated". It takes them two pages to describe what happens. I think Mozilla is a pretty good authority on this subject, so if they think it takes a lengthy description and not one word, I'd believe them.

If I was told to "populate the template" ... maybe. I'd ask for clarification just what he meant.

0

"Detokenize." The placeholders are tokens, and the template has been tokenized. You're undoing that process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .