What would you suggest the correct behaviour should be?

On Thu, Sep 3, 2009 at 2:37 PM, Matthew Wilson <[email protected]> wrote:

> I should've specified: I agree with you; yes, throwing on EOF is
> incorrect... but returning an empty string is also incorrect (since it's
> also stripping the newlines).  If it weren't stripping the newlines,
> returning an empty string would be okay...
>
>
> On Wed, Sep 2, 2009 at 11:36 PM, Abdulla Kamar <[email protected]>wrote:
>
>> I'd still argue that throwing on EOF is incorrect behaviour.
>>
>>
>> On Thu, Sep 3, 2009 at 2:24 PM, Matthew Wilson <[email protected]>wrote:
>>
>>> You'd think that, but   try{ do{ i += readline()+"\n" }while(true)
>>> }catch(e){};
>>> is a few % *slower* every time for me (2,500,000 line input to stdin)
>>> than
>>>    do{ try{ i += readline() + "\n" }catch(e){ break }}while(true)
>>>
>>>
>>> On Wed, Sep 2, 2009 at 10:53 PM, Abdulla Kamar 
>>> <[email protected]>wrote:
>>>
>>>> Well in terms of semantics, it's not the correct thing to do (throw when
>>>> reaching the end of file). Other than that, Isaac was saying that it's
>>>> incorrect for the benchmarks - and I would add that it could also cause the
>>>> benchmarks to show incorrect timings due to exception handling overhead.
>>>>
>>>>
>>>> On Thu, Sep 3, 2009 at 1:46 PM, <[email protected]> wrote:
>>>>
>>>>> I disagree.. how is it holding it up?  What's wrong with wrapping
>>>>> readline() in try/catch, as I did in
>>>>>
>>>>> http://shootout.alioth.debian.org/u32/benchmark.php?test=regexdna&lang=all
>>>>>
>>>>> (where, incidentally, JavaScript V8 beats all other implementations)
>>>>>
>>>>>
>>>>> http://codereview.chromium.org/173262
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thank you
>>>> Abdulla
>>>>
>>>
>>>
>>
>>
>> --
>> Thank you
>> Abdulla
>>
>
>


-- 
Thank you
Abdulla

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to