1. Euphoria v4.03 bug in "append" ?
- Posted by alanjohnoxley Jan 22, 2012
- 1371 views
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()
2. Re: Euphoria v4.03 bug in "append" ?
- Posted by mattlewis (admin) Jan 22, 2012
- 1350 views
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
3. Re: Euphoria v4.03 bug in "append" ?
- Posted by alanjohnoxley Jan 22, 2012
- 1343 views
Thanks Matt,
I did get caught for a while with this. I guess I will need to be more careful :)
Cheers,
Alan
4. Re: Euphoria v4.03 bug in "append" ?
- Posted by petelomax Jan 23, 2012
- 1275 views
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.
5. Re: Euphoria v4.03 bug in "append" ?
- Posted by mattlewis (admin) Jan 23, 2012
- 1267 views
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
6. Re: Euphoria v4.03 bug in "append" ?
- Posted by alanjohnoxley Jan 26, 2012
- 1226 views
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
7. Re: Euphoria v4.03 bug in "append" ?
- Posted by mattlewis (admin) Jan 26, 2012
- 1213 views
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
8. Re: Euphoria v4.03 bug in "append" ?
- Posted by alanjohnoxley Jan 26, 2012
- 1205 views
OK, ticket #743 opened.
Thanks!