Why does `\coordinate` fail but `\node` succeed at an intersection of two paths?

In essence, \coordinate is an alias for \node[shape=coordinate]. Looking through tikz.code.tex, it would appear that \coordinate[options] becomes \node[shape=coordinate,options] and so your \coordinate syntax ought to work. I'm not entirely sure why it doesn't (and my investigation time is a bit short today), but the following code does work, which I would say shows that the intention is that the original syntax should work and that that it doesn't might be considered a bug (though I'd investigate further to see exactly where it breaks down before filing it).

\documentclass[border=5mm]{standalone}
%\url{http://tex.stackexchange.com/q/364184/86}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (10,10);
\draw[very thick,rotate around={45:(2.3,5)}] (2.3,5) rectangle ++(4,0.3) ++(0,-0.15) coordinate (p2);
\draw[name path=1st] (1.8,4)--(1.8,6);
\draw[name path=2nd] (p2)--+(225:5);
\coordinate[name intersections={of=1st and 2nd},name=i12,at=(intersection-1)]; 
\fill[red] (i12) circle (2pt);
\end{tikzpicture}
\end{document}

(A bit of cutting and pasting shows that it is the at part that causes the problem. Putting at=(intersection-1) as an option works, but at (intersection-1) afterwards doesn't.)


Update: I see the problem now. When you use the at (intersection-1) syntax then TikZ calculates the location of (intersection-1) at the point when it parses that option. This is, as @TeXnician says, a problem because intersection-1 has not yet been calculated. But when at=(intersection-1) is passed as an option, this is not calculated until much later in the process whereupon the path intersection has been calculated.

Nodes are different here because the processing for nodes is a bit different to that for coordinates. Essentially, the \coordinate is doing some pre-processing before shipping off its stuff to the \node. This is necessary, but does mean that things get processed in a slightly different order than for \nodes.


One version would be to use

\coordinate[name intersections={of=1st and 2nd,by=i12}];
\fill[red] (i12) circle (2pt);

which names the point using intersections. Another option is to use

\coordinate[name intersections={of=1st and 2nd}];
\fill[red] (intersection-1) circle (2pt);

or

\path[name intersections={of=1st and 2nd}];
\coordinate (i12) at (intersection-1);
\fill[red] (i12) circle (2pt);

which uses the internal name for the intersection.

Your code does not work, because the intersection is not known to TikZ at this stage, so it cannot assign the coordinate to the point.