ReturnValue for PopListPosition() + ChangeCurrentElement()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

ReturnValue for PopListPosition() + ChangeCurrentElement()

Post 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.
sorry for my bad english
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: ReturnValue for PopListPosition() + ChangeCurrentElemen

Post 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
Post Reply