I have read that, everything is literal inside braace {}
(except backslash-newline in Tcl.
So, this is expected:
% puts {\{}
\{
However, I do not understand properly the following:
% puts { {}
<waits for close brace>
I would expect it to print {
, since it is inside braces and should be taken literally. What I expect is: once you encounter a open brace, take everything literally until you encounter the first closing brace. But this does not seem to happen. Please clear my misunderstanding.
Braces nest (unless quoted) inside a braced word because that's the rule ([6] in the Dodekalogue). The reason for this rule is that the contents of a braced word is very often a structured expression with several open and close braces, quite possibly even several levels of open and close braces. The benefit of having the parser complain about unbalanced braces outweighs the hassle of having to quote the braces when you aren't using them to structure the expression.