1

In most contexts, the concept of "interpolation" seems to be related to estimating unknown states from known ones, like video frames or data points.

From the Wikipedia entry on interpolation:

In the mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing new data points within the range of a discrete set of known data points.

In engineering and science, one often has a number of data points, obtained by sampling or experimentation, which represent the values of a function for a limited number of values of the independent variable. It is often required to interpolate, i.e., estimate the value of that function for an intermediate value of the independent variable.

And from the Wikipedia entry on interpolation (computer graphics):

In the context of live-action and computer animation, interpolation is inbetweening, or filling in frames between the key frames. It typically calculates the in-between frames through use of (usually) piecewise polynomial interpolation to draw images semi-automatically.

Now, from what I understand, string interpolation is the evaluation of an expression inside a string literal. From the Wikipedia entry on string interpolation:

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. It is a form of simple template processing or, in formal terms, a form of quasi-quotation (or logic substitution interpretation). String interpolation allows easier and more intuitive string formatting and content-specification compared with string concatenation.

What I don't get is what exactly is being interpolated during string interpolation. There's no estimation involved in the process, right? Am I interpreting these concepts in the wrong way? How are they related?

3
  • 5
    The term interpolation in the English language (and therefore also Mathematics and Computer Graphics) is not about estimation or calculation, it means "insertion". So 'String interpolation' is about inserting values into a string. Dec 26, 2020 at 23:56
  • 2
    And even IFF everything you were saying were true, your whole question is still based on the wrong premise that there can only be one single meaning of a word, across all possible different communities. That is not true. The same word can mean different things in different communities. For example, the word functor in category theory has also been used in functional programming to mean something closely related. It, however, is also used in C++ to mean something totally unrelated. Dec 27, 2020 at 7:51
  • You can't infer anything from the name of a thing.
    – philipxy
    Dec 28, 2020 at 1:24

1 Answer 1

6

The mathematical use of "interpolation" is not the only meaning. Quoting the Wiktionary entree on interpolate [emphasis from original]:

  1. (transitive, intransitive) To introduce (something) between other things; especially to insert (possibly spurious) words into a text.
  2. (mathematics) To estimate the value of a function between two points between which it is tabulated.
  3. (computing) During the course of processing some data, and in response to a directive in that data, to fetch data from a different source and process it in-line along with the original data.

String iterpolation is an example of meaning 1, not meaning 2.

Also notice that meaning 2 is derived from meaning 1: "to interpolate" is used to mean "insert a data point between two other datapoints (by means of estimation)".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.