ReneMiner
08-07-2020, 11:23
I am Not Sure its years ago but i thought Eros Said, No Problem for static members to assign the value on Definition of a Type since statics are Same to all objects of the Type.
Somehow it does Not Accept , i tried value, equal-sign and even without and the equate-style
Type tApple
Static is_a1 AS String Value "fruit"
'nor
Static is_a2 As String = "fruit"
' neither
Static $IS_A "fruit" As String
' Not even
Static String Value "fruit" To is_a$
'and Not
Static String isA$ Value "fruit"
End Type
IT we're also OK If on udt-definition assigned statics we're named Const which tells the Parser that an assignement will follow to the actual static member and IT must Not Change its value again.
That's the one Thing. The other ist Bit complex but related.
Assume the udt like
Type tVec2L
X AS Long 'Type-Scope
Y AS Long
Function _Create(Byval lX as Long, Byval lY as Long)
X= lX
Y= lY
End Function
Function Put(Byval lX as Long, Byval lY as Long)
Me.X=lX
Me.Y=lY
End Type
As obvious X and Y subelements of the Udt used without to refer to Me.
to clarify:
Within _Create() actually the X and Y are already used variables in Type-Scope that WE prefix Me currently. They should be available without Me inside the Type-EndType and no more possible to use again Same variable names local in functions Nor AS parameter-names of Type Functions.
To dim X or Y within the types function must result in an Error. Because
Use of Me:
If we append the tVec2L as position or size to an Udt of a window-udt- who will be Me?
Difficult because the call starts as
MyWin.Position.Put(x,y)
Obviously even If attached to the window which is the object- the properties - since their scope during Put() are what is named ME Here
But how within the call If Me.X and Me.Y mean the Position
but Not the window?
How we get a reference to the owner of the property "Position"???
Position must Not become Me! That's why X and Y have to BE valid in scope of tVec2L without the Me
That's why nga.
Me has to become /Stick to the actual highest scope the First of the dot-notation-seperated Expression. The Main object.
And what is x and y within the udt tVec2L must become within the type-function somewhat Like global variables in global Functions.
In Type-Scope the udt-subelements must BE available inside the types Functions without any prefix. If With-End With- construct became illegal within Type-Scope IT we're a possibility that X and Y in _Create() were used AS .X and .Y to refer to current Type-Scope but it still should be illegal to dim X local within a types function If the Type has a subelement X already.
So the Type have between Type and End Type a Type-scope that appears as a global scope within the Functions of the Udt while from global scope they must BE prefixed AS "myobj.myvar".
I Hope i was able to Express IT a way IT IS understandeable.
If types have their own scope between global scope and Type Functions scope - so Type Functions scope becomes one Level lower than now it will be much easier to implement actually working Public and Private accessible properties and type-functions.
But for now it should be the step to make Me stick with the Maintype. And Access udt-subelements without prefixing from within Type Functions.
Somehow it does Not Accept , i tried value, equal-sign and even without and the equate-style
Type tApple
Static is_a1 AS String Value "fruit"
'nor
Static is_a2 As String = "fruit"
' neither
Static $IS_A "fruit" As String
' Not even
Static String Value "fruit" To is_a$
'and Not
Static String isA$ Value "fruit"
End Type
IT we're also OK If on udt-definition assigned statics we're named Const which tells the Parser that an assignement will follow to the actual static member and IT must Not Change its value again.
That's the one Thing. The other ist Bit complex but related.
Assume the udt like
Type tVec2L
X AS Long 'Type-Scope
Y AS Long
Function _Create(Byval lX as Long, Byval lY as Long)
X= lX
Y= lY
End Function
Function Put(Byval lX as Long, Byval lY as Long)
Me.X=lX
Me.Y=lY
End Type
As obvious X and Y subelements of the Udt used without to refer to Me.
to clarify:
Within _Create() actually the X and Y are already used variables in Type-Scope that WE prefix Me currently. They should be available without Me inside the Type-EndType and no more possible to use again Same variable names local in functions Nor AS parameter-names of Type Functions.
To dim X or Y within the types function must result in an Error. Because
Use of Me:
If we append the tVec2L as position or size to an Udt of a window-udt- who will be Me?
Difficult because the call starts as
MyWin.Position.Put(x,y)
Obviously even If attached to the window which is the object- the properties - since their scope during Put() are what is named ME Here
But how within the call If Me.X and Me.Y mean the Position
but Not the window?
How we get a reference to the owner of the property "Position"???
Position must Not become Me! That's why X and Y have to BE valid in scope of tVec2L without the Me
That's why nga.
Me has to become /Stick to the actual highest scope the First of the dot-notation-seperated Expression. The Main object.
And what is x and y within the udt tVec2L must become within the type-function somewhat Like global variables in global Functions.
In Type-Scope the udt-subelements must BE available inside the types Functions without any prefix. If With-End With- construct became illegal within Type-Scope IT we're a possibility that X and Y in _Create() were used AS .X and .Y to refer to current Type-Scope but it still should be illegal to dim X local within a types function If the Type has a subelement X already.
So the Type have between Type and End Type a Type-scope that appears as a global scope within the Functions of the Udt while from global scope they must BE prefixed AS "myobj.myvar".
I Hope i was able to Express IT a way IT IS understandeable.
If types have their own scope between global scope and Type Functions scope - so Type Functions scope becomes one Level lower than now it will be much easier to implement actually working Public and Private accessible properties and type-functions.
But for now it should be the step to make Me stick with the Maintype. And Access udt-subelements without prefixing from within Type Functions.