Page 1 of 1

ReturnValue for PopListPosition() + ChangeCurrentElement()

Posted: Thu May 16, 2019 9:49 am
by Josh
Most commands that change the position pointer of a LinkedList return the pointer to the new element. Unfortunately this is not the case for:
  • PopListPosition()
  • ChangeCurrentElement()
    Even if the new element is specified in the parameter here, a return value would be useful for a better code and for reasons of symmetry to other list commands. The parameter can e.g. come from a stack and should be stored in a global pointer after changing the position pointer.
For the same reasons, the commands
  • ClearList()
  • FreeList()
  • ResetList()
should have a return value of zero so that a pointer can be deleted by the return value.

Re: ReturnValue for PopListPosition() + ChangeCurrentElemen

Posted: Thu May 16, 2019 6:55 pm
by kenmo
+1
Agree, if possible. They already seem to return some integer values (???) which maybe are being used somehow internally...

But I like the idea. If you have the opportunity to return a convenient value, do it.

I like to return #Null on freeing too, like:

Code: Select all

*MyObject = CreateObject()
; do some stuff
*MyObject = FreeObject(*MyObject) ; now #Null