Unintuitive here document behavior: bug or feature?

Anthony Vanelverdinghe anthony.vanelverdinghe at gmail.com
Sun Feb 22 11:12:09 UTC 2015


Hi

When using a here document, statements that are on the same line as the 
initial <<EOD are interpreted as JavaScript & executed after the 
"heredoc statement". Is this a bug or a feature?

For example:

var a = 2;
print(<<EOD); a = 3; print("here")
a++;
${a}
EOD
print(a);

prints

a++;
2
here
3

Kind regards, Anthony


More information about the nashorn-dev mailing list