Page 1 of 1
[low priority] CountListItems()
Posted: Thu Jun 09, 2011 10:11 am
by Michael Vogel
Some PB function names are difficult to remember, many user don't feel happy to write all these hide commands (HideGadget, HideWindows etc.) which look so negative

, for me I have to think twice when searching the right name for the functions to get the number of entries in a gadget or list - what about creating an alias for ListSize() which allows also to use CountListItems() ?
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 10:32 am
by Shield
Why don't you just use a macro?
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 10:46 am
by Michael Vogel
Shield wrote:Why don't you just use a macro?
At the first moment, I considered to do that (especially if the PB IDE would include something like a "standardinclude.pbi" automatically) -- but it's like these many other procedures and macros (Min, Max, AbsInteger, FindStringRight etc.): sharing code with others will get more complicate, each included function have to be synchronized as well...
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 12:48 pm
by gnozal
You may create a custom resident : the macro will be known by the PB compiler without the need of including anything.
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 1:16 pm
by Shield
Won't solve the problem with sharing code though.
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 1:30 pm
by Little John
Officially providing different names for the same built-in function will decrease readability of the code, and will be confusing especially for newbies. I honestly hope that this is not going to happen.
And I can't see any problem with using macros for this purpose, in case soemone individually prefers to use different names.
Regards, Little John
Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 4:20 pm
by skywalk
Macros are great, except in debug mode.

Same is true using With...EndWith.
I do wish earlier on, there was an effort to standardize the core function names.
Take a noun-verb approach instead of verb-noun.
This way the AutoComplete and libraries line up!
And talk about helping out the newbies
ex.
StringReplace() instead of ReplaceString()
StringRemove() instead of RemoveString()
MemoryAllocate() instead of AllocateMemory()
MemoryCompare() instead of CompareMemory()
~... you get the idea
Then, the functions become intuitive.
StringGadget() wouldn't pop up when I'm typing 'Str', because that would be GadgetString(), along with all the other Gadgetsxxx().
Think how frustrating it would be if the #Constants were verb-noun?
#PB_ActivateWindow_Event instead of
#PB_Event_ActivateWindow
#PB_ClientConnected_Event instead of
#PB_Event_ClientConnected
Too bad the functions themselves were not similarly named?

Re: [low priority] CountListItems()
Posted: Thu Jun 09, 2011 7:37 pm
by Trond
I do wish earlier on, there was an effort to standardize the core function names.
The reason we don't have CountList() but do have ListSize() is because it was standardized to match ArraySize() and MapSize().
Edit: It still works, but it's deprecated.
Code: Select all
NewList l()
AddElement(l())
Debug CountList(l())