Because UDTs can have static members too I came to an idea that reminds a little to vb. There constant enumerations work like the following example:
imagine this translated to tB:Code:Enum Direction [As Long]
Left = 1
Right
Up
Down
End Enum
thereafter in vb it's not necessary to "Dim anyVar As Direction" but one can use instantlyCode:Type Direction
Static Left As Long = 1 ' i know currently not possible to assign value here
Static Right As Long ' will be 2 now...
Static Up As Long ' these anyway will remain constantly same value
Static Down as Long
End Type
now what's better about this then the current way as below?Code:doSomething( Direction.Up ) ' assume doSomething is a Sub here...
imagine to have some autocomplete-function in some (still to develop) smart thinBasic-IDE that will bring up a list of possible subitems of types, classes and enumerations when pushing the dot-key (.) Some IDE that not just lists Udts, Functions, Subs and Callbacks in codebrowser but also only shows one function or declarations-section only per code-window, one, that is "project-oriented" - means, it loads all used #include-files to editor and also has a variables-list-tab next to codebrowser that shows global and local to current functions variables & their types. "Declarations-section" is just like code that is not contained within any function.Code:Begin Const
%Direction_Left = 1
%Direction_Right
%Direction_Up
%Direction_Down
End Const
One that inserts "Then" automatic when user types "If ". Just push like Shift+TAB-Key to jump behind the "Then" or Shift+Return-Key to go into the next line without adding code behind "Then". The IDE will be smart enough to add some "EndIf" one line below if nothing follows "Then" . And of course - if one types "ElseIf " - automatic "Then" added too. Same behaviour of course when codeline in declarations section starts with Function/Sub/Callback Function: It'll automatic switch from declarations-section to the new Functions/Subs code and of course it has "End Function/End Sub" added automatically then.
Another feature: Pushing double-quote will automatic make double-quotes twice- one at current caret-position and one thereafter- press Shift+Tab here also to get out of the quoted part in same line, Shift+Return will jump out of the quoted part into the next line while just return will move the end-quote into the next line.
Of course all "Begin" will automatic add the "End" - no matter if Select Case, While, Do or whatever. And as mentioned - typing a dot outside quotes will bring up a list of possible members to choose from.
Oh yes, I forgot... the variables-list (tab next to codebrowser) inserts on click on a listed variable even this variable at current caret position. Variables list looks somewhat like this:
Difference is, all Functions, UDTs etc of all to project #Includeds are listed in this tree, oriented to the whole project.Code:' this is source code
' Declarations-Section
#Include "thinBasic_gl.Inc"
Type t_vec3d
X As Double
Y As Double
Z As Double
Static num As Long ' holds "number_of_myVecs"
Test as Function
End Type
Dim keepRunning As Boolean = True
Dim myVec() As t_vec3d
Dim foo as String = "Byte"
'...
' this is current edited function displayed in code-editor
Function Vec3d_GetID( Byval X as Double, Byval Y as Double, Byval Z as Double) As Long
Local lID As Long
Local toFind As t_Vec3d
' just for Fun:
Dim noSense Like foo
toFind.X = X
toFind.Y = Y
toFind.Z = Z
If toFind.num > 0 Then
lID = Array Scan myVec For toFind.num, Byte(1, SizeOf(t_vec3d)), = toFind
EndIf
If lID Then
' found this vec3d:
Return lID
Endif
' need a new one...
If toFind.num = 0 Or toFind.num >= UBound(myVec) Then
' allocate more space if reach UBound
ReDim Preserve myVec(toFind.num + 1000)
EndIf
toFind.num += 1
myVec(toFind.num) = toFind
Function = toFind.num
End Function
' #####################################
' this is variables list, another Tab next to codebrowser, "local" depends on current edited function:
Global
keepRunning, Boolean
myVec, t_vec3d, Array
foo, String
Local
X, Double, parameter ByVal
Y, Double, parameter ByVal
Z, Double, parameter ByVal
lID, Long
toFind, t_vec3d
noSense, Variable
' clicking onto a variable here will insert it to code-window at current caret position
' #####################################
' and this is codebrowser-tree, all expanded and contains lots of information
-Project "myProject" ' equals a folders name on HD
-Includes
"MAIN.tBasic"
"thinBasic_gl.Inc"
-UDTs
-t_Vec3d
X As Double
Y As Double
Z As Double
Static num As Long
Test As Function
-Declarations
-"thinBasic_gl.Inc"
Function glAreTexturesResident
Function gl... there's a lot of...
Sub glAccum
Sub gl... also a whole lot of subs declared within thinBasic_gl.Inc...
-Functions
-"MAIN.tBasic"
TBMain '(this always listed as first)
Vec3d_GetID
+Subs
+Callbacks
+Notes
OK, that went a little out to some more than just constant type-lists abusing static udt-members as global const enumerations, but I think it contains ideas...
I'm still not sure which software (i.e. "Control") to use to write this editor, currently I prototype in TBGL(2d) because RTF is cumbersome as hell and common textbox does not allow colored code. (now since optional parameters in Type-functions work, my new nodes also work finally and also my TBGL-Treeview-Gadget ;) - but coding itself in a TB-written editor is a little lagging, especially when it comes to create the list of possible expressions for autocomplete and on re-scanning the current function for "AS" and "LIKE" on every Return-Key hit and always re-scan if a section of code was marked before...(think of CTRL+X etc.) or if CTRL+V was pushed.
I hope one of you can see the need of some smart IDE too, one that offers a lot of overview, minimizes the amount of bugs where possible (automatic parenthesis-count in codelines, adding End to any started etc.) and increases coding speed also. Still a lot to do... maybe someone with some experience in creating coding environments will overtake and be faster...