The verbosity isn't the issue. I think that strictly-typed language with self-documenting verbosity is a good thing. The only real frustration I have with using PureBasic is the inability to lay my code out in a clear and concise manner with the added verbosity I need to keep things clear.
My memory isn't what it used to be and I need the added verbosity to help me read and understand the intent of my code. I do document my code of course but because PureBasic is still fairly loosely typed I end up using macros as typedefs throughout my code to clearly define types.
Here is one example:
Code: Select all
Procedure Map_InsertNode(*Map, *Node, Key, Value, *OldValue, *HasKey, CanReplace)
This is a single procedure from a left-leaning red-black tree (map) data structure written in traditional PureBasic without any added self-documenting verbosity. It would work just fine as it is but it's difficult to know how to use and call it
at a glance. All of the parameters are documented but I don't want to have to refer to the documentation every single time I want to call it because the declaration is inherently ambiguous.
Here is the actual procedure as it appears in my code (notice that it is very difficult to read due to line-splitting constraints):
Code: Select all
Procedure.MAP_NODE_POINTER Map_InsertNode(_IN *Map.MAP_TREE,
_IN *Node.MAP_NODE, _IN Key.MAP_KEY, _IN Value.MAP_VALUE,
_OUT *OldValue.MAP_VALUE_REFERENCE, _OUT *HasKey.BOOLEAN_REFERENCE,
_IN CanReplace.BOOLEAN)
The return type and each parameter is clearly declared as to what it is through macro-defined typedefs. Here is a breakdown of just this ONE procedure with related snippets:
h.Types.pb:
Code: Select all
Macro POINTER
i
EndMacro
Macro UINT_8
a
EndMacro
Macro UINT_32
l
EndMacro
Macro INT_32_64
i
EndMacro
Macro BOOLEAN
b
EndMacro
Structure _Types_Boolean_Reference
Deref.b
EndStructure
;/ IDE auto-complete workaround
CompilerIf #False
Structure BOOLEAN_REFERENCE Extends _Types_Boolean_Reference
EndStructure
CompilerEndIf
Macro BOOLEAN_REFERENCE
_Types_Boolean_Reference
EndMacro
...
h.SAL.pb:
Code: Select all
Macro _IN
EndMacro
Macro _OUT
EndMacro
...
h.Map.pb:
Code: Select all
Macro MAP_NODE_COLOR
UINT_8
EndMacro
Macro MAP_NODE_POINTER
POINTER
EndMacro
Structure _Map_Tree
*Root._Map_Node
EndStructure
Structure _Map_Node
*Left._Map_Node
*Right._Map_Node
Key.INT_32_64
Value.POINTER
Color.MAP_NODE_COLOR
Size.UINT_32
EndStructure
;/ IDE auto-complete workaround
CompilerIf #False
Structure MAP_NODE Extends _Map_Node
EndStructure
CompilerEndIf
Macro MAP_NODE
_Map_Node
EndMacro
;/ IDE auto-complete workaround
CompilerIf #False
Structure MAP_TREE Extends _Map_Tree
EndStructure
CompilerEndIf
Macro MAP_TREE
_Map_Tree
EndMacro
Structure _Map_Value_Reference
Deref.INT_32_64
EndStructure
Macro MAP_KEY
INT_32_64
EndMacro
Macro MAP_VALUE
POINTER
EndMacro
Procedure.MAP_NODE_POINTER Map_InsertNode(_IN *Map.MAP_TREE,
_IN *Node.MAP_NODE, _IN Key.MAP_KEY, _IN Value.MAP_VALUE,
_OUT *OldValue.MAP_VALUE_REFERENCE, _OUT *HasKey.BOOLEAN_REFERENCE,
_IN CanReplace.BOOLEAN)
...
And this is how I would like to write this procedure if I could:
Code: Select all
Procedure.MAP_NODE_POINTER
_Map_InsertNode(
_IN *Map.MAP_TREE,
_IN *Node.MAP_NODE,
_IN Key.MAP_KEY,
_IN Value.MAP_VALUE,
_OUT *OldValue.MAP_VALUE_REFERENCE,
_OUT *HasKey.BOOLEAN_REFERENCE,
_IN CanReplace.BOOLEAN
)
Other issues with the verbosity I use include:
viewtopic.php?f=3&t=66909
viewtopic.php?f=3&t=66910
Related requests on whitespace:
viewtopic.php?f=3&t=66631
viewtopic.php?f=3&t=61025
As much as I appreciate the features added to PureBasic over the years, I've barely used any of them. The only time I ever get excited about a release is when there will be improvements to the language itself which is rare to see.
I may sound bitter but it's only because of how many years I've used PureBasic. I love it. But as I've grown as a programmer and been exposed to other languages, it's no longer the pleasure to use that it once was.