Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message
mindwalker said...

Since append currently works the way I thought I remembered it did, I disagree Pete with your statement. The proposed change could break a working program.

So some "slick" programmer may have realized that the first append would abort if the first object in the line wasn't a sequence. So said programmer may have skipped the separate sequence test and depended on the append function working as documented.

This is a particularly expensive way of doing that test, as you can't catch or trap exceptions like this. The error would abort the entire program. One would need to use multiple processes and have a master program that detected when the subprogram crashed and take appropriate action at that point. And of course, if the subprogram was halfway thru a giant list of records, that time is wasted as it'll have to start again from the begining.

Much simpler to just do the check manually in the first place.

mindwalker said...

Five years of running this program every hour 24x7x365 and only 3 aborts when the input file was corrupted one way or another and the company decides to stop using Euphoria 2.4 and move to the latest and greatest OpenEuphoria.

At this point, the previously working as designed program would be broken. It would no longer be detecting and aborting if the first line item wasn't a sequence. That is unless the programmer migrating this just happens to remember/realize that the append function was providing this sequence check and modifies the program to now do its own check instead.

So if we used petelomax's suggestion of appenda()/prependa(), then there would be no problem here?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu