X-Received: by 10.66.193.227 with SMTP id hr3mr46080pac.0.1410973143108; Wed, 17 Sep 2014 09:59:03 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h3no53030igd.0!news-out.google.com!ef6ni13921igb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 17 Sep 2014 11:59:02 -0500 Date: Wed, 17 Sep 2014 19:58:44 +0300 From: Donkey Hottie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Java ScriptEngine with a JavaScript returning what? References: In-Reply-To: Message-ID: <47roeb-g68.ln1@tempest.fredriksson.dy.fi> Lines: 32 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-39agf0yi/yLjN2TUGKzmiADq/XWu9dMO6ElvyGJ31f3PbVWR5LunBVKq37WCbLKjGwsb2UvvvlO9cKt!TqBTZrWQQTsp0ziYnVlnGqP3W8+VEkTcq0sR1uqI9A0GM+DG7NZJyi5GRxiz19pd4/3v/A== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2154 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Xref: csiph.com comp.lang.java.programmer:30006 17.09.2014, 01:20, Eric Sosman kirjoitti: > On 9/16/2014 4:02 PM, Donkey Hottie wrote: >> >> Consider a JavaScript: >> >> var blah; >> blah; >> >> So what does the Java's >> >> Object ScriptEngine::eval(String script) return now? >> >> blah is not null? Is it not undefined either? Java has no "undefined" >> Object type. >> >> What will happen, what will be returned? > > null > > (Obtained by a five-minute experiment. "Five" because I have no > acquaintance with the scripting framework and had to read some doc; > a better-versed person could have obtained the answer more quickly.) > Actually I tried and experimented with this after I asked, and it resulted to me that returning null OR undefined will result as an Exception, which is unacceptable for my purposes. So I will not return those values from my script any more. An empty string '' works fine. -- A day for firm decisions!!!!! Or is it?