Welcome to episode 2 of Scary Words in Programming!
When you read the Angular documentation, you might read such gems as:
ngTransclude: Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion. (source)
What the shit does that mean? Just because you use a word over and over again, Angular, doesn’t mean you described it!
Luckily transclusion really isn’t that scary … transclusion is including another thing in your first thing, by reference.
Well, if you understand what people talk about when they talk about web components, then you understand transclusion. If I wrote some thing (a), somewhere, and I then include that thing in what I’m working on now (b), I’ve transcluded it. If I make a change to a, it is reflected in b, because of being passed by reference.
So you understand it, but didn’t know it!
Interestingly, transclusion was coined by the same person who coined “hypertext” and “hypermedia” – which are other ideas relating to the idea that you should be able to define something once, and then pass it around (share it) among other implementations. If you’re interested in it, that book has plenty of scary – or made up, your choice – words to check out.
One Reply to “Transclusion: Scary words in programming, episode 2”
One very familiar example of transclusion is the IMG tag from HTML, at least where the @src is a web URL and not a data: one.