1. Euphoria v4.03 bug in "append" ?

I discovered that missing the left hand side of a assignment where the right hand side was "append", does not give any error, it just continues...
I had a quick look in the bug index, but did not see this.
Is this "working as designed"?
Eui - v gives:
Euphoria Interpreter v4.0.3 development
Windows, Using Managed Memory
Revision Date: 2011-06-24 13:43:18, Id: 4985:26b65e77e3d9

-- Eu v4.0.3 issue with assignment missing in a append statement  
with warning 
with trace 
with type_check 
without profile 
procedure test() 
    sequence s1, s2 
    s1 = {}  
    s2 = {"dummy data"} 
    append(s1,s2) 
    -- which should have been 
    -- s1 = append(s1,s2) 
end procedure 
test() 
 
    
new topic     » topic index » view message » categorize

2. Re: Euphoria v4.03 bug in "append" ?

alanjohnoxley said...

I discovered that missing the left hand side of a assignment where the right hand side was "append", does not give any error, it just continues...

I had a quick look in the bug index, but did not see this.

Is this "working as designed"?

Yes. It is legal to ignore the return values of functions starting with Euphoria 4.0

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Euphoria v4.03 bug in "append" ?

Thanks Matt,
I did get caught for a while with this. I guess I will need to be more careful :)
Cheers,
Alan

new topic     » goto parent     » topic index » view message » categorize

4. Re: Euphoria v4.03 bug in "append" ?

mattlewis said...

Yes. It is legal to ignore the return values of functions starting with Euphoria 4.0

Matt

Of course I've known this for a while, but there are a large number of builtins for which this makes no sense:

    open 
    allocate (/allocate_string) 
    call_back 
    sort (/custom_sort) 
    equal 
    compare 
    find 
    match 
    length 
    remainder 
    floor 
    where 
    rand 
    and_bits 
    or_bits 
    xor_bits 
    not_bits 
    time 
    power 
    log 
    instance 
    cos 
    sin 
    sqrt 
    tan 
    arctan 
    append 
    prepend 
    repeat 
    get_position 
    peek 
    peek4s 
    peek4u 
    define_c_func 
    define_c_proc 
    routine_id 
    platform 
    arccos 
    arcsin 
    define_c_var 
    open_dll 
    current_dir 
    peek_string 
    sprintf 
    sprint 
    command_line 
    date 
    db_table_list 
    reverse 
    get_screen_char 
    db_record_data 
    db_record_key 
    dir 
    getenv 
    upper 
    lower 
    peek2s 
    peek2u 

The top four are pretty bad programming mistakes:
opening a file you cannot read, write, or close
allocating memory you cannot use or free
defining a call_back you cannot call
sorting a table then throwing the sorted result away and leaving the original unsorted

Pete

EDIT: Perhaps it should be illegal to ignore the result of a function call if that function has no side-effects.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Euphoria v4.03 bug in "append" ?

petelomax said...

EDIT: Perhaps it should be illegal to ignore the result of a function call if that function has no side-effects.

I'm not sure I'd want it to be illegal, but a warning makes sense to me.

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: Euphoria v4.03 bug in "append" ?

Yes, if there was a warning I would have saved some debugging time. :)
My actual program was much more complex of course, the supplied example was for simplicity's sake.
Looking at Pete's list, there is a lot of places for the issue to bite programmers.
Can this request be added to the "nice to have" list please?

Regards, Alan

new topic     » goto parent     » topic index » view message » categorize

7. Re: Euphoria v4.03 bug in "append" ?

alanjohnoxley said...

Yes, if there was a warning I would have saved some debugging time. :)
My actual program was much more complex of course, the supplied example was for simplicity's sake.
Looking at Pete's list, there is a lot of places for the issue to bite programmers.
Can this request be added to the "nice to have" list please?

Yes, it can. Please enter a ticket.

Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: Euphoria v4.03 bug in "append" ?

OK, ticket #743 opened.
Thanks!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu