Re: Euphoria v4.03 bug in "append" ?
- Posted by petelomax Jan 23, 2012
- 1274 views
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.