Unintuitive here document behavior: bug or feature?

A. Sundararajan sundararajan.athijegannathan at oracle.com
Mon Feb 23 03:46:49 UTC 2015


Hi,

It appears to be a bug to me. Thanks for reporting. I filed 
https://bugs.openjdk.java.net/browse/JDK-8073612

Thanks,
-Sundar

On Sunday 22 February 2015 04:42 PM, Anthony Vanelverdinghe wrote:
> 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