
[low priority] CountListItems()
- Michael Vogel
- Addict
- Posts: 2798
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
[low priority] CountListItems()
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()
Why don't you just use a macro?
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
- Michael Vogel
- Addict
- Posts: 2798
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: [low priority] CountListItems()
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...Shield wrote:Why don't you just use a macro?
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: [low priority] CountListItems()
You may create a custom resident : the macro will be known by the PB compiler without the need of including anything.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: [low priority] CountListItems()
Won't solve the problem with sharing code though.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: [low priority] CountListItems()
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
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()
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?

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?

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: [low priority] CountListItems()
The reason we don't have CountList() but do have ListSize() is because it was standardized to match ArraySize() and MapSize().I do wish earlier on, there was an effort to standardize the core function names.
Edit: It still works, but it's deprecated.
Code: Select all
NewList l()
AddElement(l())
Debug CountList(l())