SelectElement() shorthand ?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

SelectElement() shorthand ?

Post by USCode »

It might be handy if the PB compiler could handle some shorthand that would eliminate the need to call linked list command SelectElement() ...

For example, it would be nice if instead of this ...

SelectElement(mylist(), 7)
mylist()\MyField = 12345

... we could do this instead:

mylist(7)\MyField = 12345

This shorthand would issue an implicit SelectElement and make element 7 the current list element before the assignment.

Doable?
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: SelectElement() shorthand ?

Post by STARGÅTE »

Good idea, should problems with arrays not exist, since they may not have the same name.

But a note:
SelectElement() wrote:As linked lists don't use an index, it will jump compulsory to every element until the target position is reached. If a faster method is needed, ChangeCurrentElement() should be used.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply