ideas? ok. i call it required rules to avoid complications.
I suggest also a voluntary possibility that users could prefix globally dimensioned UDTs and Variables.
Mandatory: it must be a global dimensioned object when using the prefix.
Voluntary: the use of it for now.
I am not sure what char or sign to use, thoughts:
the first "unused" ascii-char on my keyboard is !
!
in combination with equal-sign in some languages it means NOT ( != where we use <> in tB)- as i see, RegEx uses ?! for preview negation- thats why exclamation marks no good for a prefix...
@ = AT
- i think in the future we might be able to use "With Long @myVar" to one-time gain a byref-access... also no good candidate.
?
question-mark has always been a shortcut for query/print or to access help- no good neither...
~ chr$(126), \0x7D
this is used to shorten filenames or strings by windows. For us always wrapped between $DQ - some could say it means "Round" or "Near" but to be honest, using round()-function in thinBasic is rare and for shortcutting it X=Round(X) we could do as with +=, -= :: X~=X so it were always followed by an equal sign. Anyway, it can stay a delimiter - no need to add it to the
alphanumeric tokens. Only ~ means now follows a Global user variables name.
{} []
we could place it between curly braces or brackets to tell on local scope we want to access a global.
the curly ones are used to insert values into string-expressions and also we will have a problem if
thinBasic is not going to become "thinBasic 3.0" but "thin# 1.0"
so either ~x or [x] ?
As said - usage voluntary for the meantime...
if within a function a local variable has equal name as a global one it were a way to access explicit the global one without the workaround to pass the global byref as an additional parameter.
___________________________________________________________________________
The other thing- as always there is one
(in my case a dozen at once):
Thinking of private scope etc. to limit accessing subelements of udts even to such
that are ReadOnly or WriteOnceOnly or absolutely inaccessible from outside its a few steps
and requires that udt-subelements have a description-part which is not accessible to the user.
It has to be hidden somewhere with the udt-function-pointers and udt-statics and to keep
backward-compatibility we leave the current UDT defined through Type-End Type as they are -
and in mind we create a copy of the whole mechanics.
I will not name it "Class" now. After searching for a good translation of what i mean there
in italian it's "la categoria", in czech as well as in german "Kategorie" or english "category", also
"Genus" (latin/english) were a nice candidate... but i continue using "TYPE" for now.
Just keep in mind the TYPE as is should remain for backward-compatibility and for easy-usage
without any ownerships etc.
if i have
'====================================================
Type tPointL
X As Long ' X IS DEFINED ON tPointL-Scope!
Y As Long ' no other X nor Y must be Dimensioned before "End Type"
' X and Y ARE IN USE FOR THESE NOW until END TYPE
' X would override a global X except we explicit point the global ~X
' or the global X gets passed byref with another name here
' == Sizeof( Long ) * 2
' ------------------------------------------------------
function _Create(byval lX As Long, ByVal lY As Long)
X = lX
Y = lY
' do not use ME ! X and Y are already dimensioned on Type-scope!
end function
' ------------------------------------------------------
End type
'====================================================
Type tRectL Extends tPointL
W As Long
H As Long
' == Sizeof( Long ) * 4
' ------------------------------------------------------
function _Create(byval lX As Long, ByVal lY As Long,
Byval lW As Long Byval lH As Long)
X = lX
Y = lY
W = lW
H = lH
' also here X and Y inherited through extends, W and H are obvious
end function
' ------------------------------------------------------
End Type
'====================================================
until here stiill all easy to understand. A new "Category" can not extends a type but
can have subelements that are udts.
I will not name subelements of a Category like "Property" or "Member".
But all subelements content is kind of secret.
It should not be as easy as with a Type to access the subelement simply like
X=CategorizedObject.Property or CategorizedObject.Property(X)
(X might be an expression)
but have to use Get and Set or other ways ofcontrolled assignment
CategorizedObject.Property Value To ( X ) 'parenthesis= expression, no parenthesis = scalar
CategorizedObject.Property Value As ( X )
"Public" : possible to use "Value To"/Get and "Value As"/Set on it automatic
"ReadOnly" : that property only supports "Value To" or GET
"Const" : Value As/Set only once, Value To/Get always thereafter
"Private" there is no support of Value To nor As nor Get nor Set
"Union-With" kind of virtual layover allows to access parts of a property using another name and different rights
and for the local scope is no need to protect any values
Category selfdrawingObject_Rect
Public Backcolor As Long
Public BorderColor As Long
Const Bordersize As Long
' here i would like to use
'"Measurement As RectL" which provides X,Y, W and H but equals 2 times PointL also
' so write it like that:
Private Measurement As RectL
[UnionBeginWith]
Const Location [At This.Measurement] As tPointL
Const Size [At This.Measurement+[8|SizeOf(This.Location)|2 * SizeOf(Long)]]As tPointL
[UnionEndWith]
Method _Create(Byval lX as Long, Byval lY as Long, Byval lW as Long, Byval lH as Long,
optional byval lBS as Long = 1, byval lBackCol As Long = 0xFFFFFF, Byval lBordCol As Long=0)
' this makes sense to use Me - (but in common ME should mean the toplevel of the UDT/Category)
With Me.Measurement
.X=lX
.Y=lY
.W = lW
.H = lH
End With
BorderSize = lBS
Backcolor = lBackCol
BorderColor = lBordCol
DrawMe()
End Method
End Category
Long lSize =SizeOf(selfdrawingObject_Rect)
Dword myRect(Array Value Heap_Alloc(lSize), 5)
For Each sDOR In myRect
With selfDrawingObject_Rect At sDOR
i see, getting too much na... continue if ME no more nescessary within type-scope and if used it should access the primary object -the actually dimensioned variable only but not its subelements.
Bookmarks