(Less than slash greater than) … What is it?

(Less than slash greater than) … What is it?

I often see the </> symbol tossed around as a somewhat universal sigil for ?code and codey things.? Take for example this shirt we got for my stepson.

Image for postA great shirt for girls and boys

I?ve seen this symbol everywhere from highly technical documentation to evangelization about code. I?ve seen it on quite a few shirts. This raises the question ? what is it? And what does it have to do with code?

Unfortunately, </> is not particularly easy to google. That makes it kind of hard to determine a satisfactory meaning.

Generally speaking ? it doesn?t mean anything. It?s become a symbolic representation of the culture of programming and software development for some people. Some people really like it. Others might hate or reject it. However, it doesn?t have any globally agreed upon meaning as either a programming or a cultural construct.

In XML / HTML

XML, HTML, and others are what are called markup languages.

ML stands for Markup Language here. There is also the ML family of functional programming languages? Meta Language.

Markup languages essentially give semantic meaning to text. You can have HTML that looks like <nav><a href=”/about”>About Page</a></nav>. Browsers and screen readers understand the meaning of these tags and their attributes. You can use XML and other such languages more generally, such as <name>Andrew</name>. Programs that need to parse, or interpret and extract data from XML can do so consistently given an agreed-upon meaning to the markup beforehand.

Anyway, </> looks like a closing tag with no type name. You could have perhaps written </name>. XML and HTML both generally allow ?self closing? tags such as <name /> which would effectively be an empty name tag and has the same meaning as <name></name> in some contexts.

Either way, stripping out the typename leaves you with just <> or </>. </> looks kind of nice, fancy, and visually arresting. It has no semantic meaning, but it does convey a sense of having something to do with a markup language.

As Operators

An operator is a symbol or group of symbols that performs some operation or action on operands or parameters. For example, anyone reading this knows that 1 + 2 = 3. + is an operator in this context ? it does the addition operation on the 1 and 2 operands.

< and > are also very common in programming. Typically they are operators that mean the same as their mathematical counterparts and are used for less than and greater than comparison, respectively. / is also commonly used as a division operator as in 6 / 3.

However all three of these symbols can have quite a few other meanings depending on the programming language, platform, and context. For example, / can also be used as the directory separator for file system access.

</> itself is also the path combinator operator in Haskell: https://www.stackage.org/haddock/lts-12.5/filepath-1.4.2/System-FilePath-Posix.html#v:-60–47–62- and Fake (F# Make): https://stackoverflow.com/questions/34954973/what-does-the-operator-do-in-fake-build-scripts

React Fragment Short Syntax

If you?re a React (JavaScript framework) developer, you may be familiar with the new React.Fragment component which is a component that only renders its children and not itself ? useful for grouping without requiring a parent component in the output.

Rather than use <React.Fragment> and </React.Fragment> there is a short syntax available: <> and the corresponding closing tag </>. Since React components in JSX are akin to a markup language, this is very similar to the original meaning described about markup elements. I think that JavaScript and React have a strong hobbyist and evangelical culture of code. This additional meaning of </> will give a whole new meaning to people who wear shirts with the symbol emblazoned on them at conferences.

Read more here: https://reactjs.org/docs/fragments.html#short-syntax

In Summary

I don?t think that </> was ever really intended to mean anything. I can see why it was chosen for its uses in React, Haskell, and Fake. As for why it is used as a symbol for the culture of code, I have no idea about its origins. My guess is that it was most likely used because it looks cool. It?s abstract and evokes working with all kinds of different programming and markup languages. Its abstraction gives it more meaning as a cultural symbol than any concretion could.

Next time you walk around with your </> shirt, you?ll be able to readily explain to pedants who claim the symbol is meaningless about the various operators this symbol represents to your work with Haskell, React, and more.

17