PDA

View Full Version : Static Const in UDTs



ReneMiner
16-02-2015, 11:47
Because we have Static UDT-members that have the nature to be automatic part of an extended type of an udt i think it needs to be differed and i think of 3 ways:

1.


Type t_type
Static X As Long Value 123
End Type

Static udt-members should be able to assign initial value within type-description.
It should be allowed to use loaded module-functions (Ini_GetKey, RGB etc.) to assign initial value.
Static udt-members are the same to all variables of this type and to any type that Extends this type. As is currently.

2.


Type t_type
Const X As Long Value 123
End Type

Const can not be changed/assigned outside this type-description.
It should be allowed to use loaded module-functions to assign a value.
Const-members NOT automatic members of types that Extends this type,
extensions may have same named members with different content
Const-members are the same to all variables of exactly this type

3.


Type t_type
Static Const X As Long Value 123
End Type

Static Const can not be changed/assigned outside this type-description.
It should be allowed to use loaded module-functions to assign a value.
Static Const-members are as statics the same to all of this type and any type that Extends it

ErosOlmi
17-02-2015, 07:53
Ciao Rene,

added to the list of things I need to develop.

Eros

ReneMiner
12-09-2015, 10:43
Ciao Eros,

what's the current developement-state of this?
It would be nice to have the ability of this:



Type t_TypeA
Const pTypename As Dword Value Heap_AllocByStr("t_TypeA")
End Type

Type t_TypeB Extends t_TypeA
Const pTypename As Dword Value Heap_AllocByStr("t_TypeB")
End Type

' now we could differ Types without having to assign a typename to each variable...


Also i'm in need of the ability to Type t_myType Extends <numeric type> | Type t_myType As <numeric Type> (http://www.thinbasic.com/community/showthread.php?12554-Type-As)

ErosOlmi
14-09-2015, 22:13
To be honest those requests are quite far from current possibilities.

I'm currently working on adding dynamic arrays (any type) as static elements and as standard element in TYPEs.
This is quite a challenging especially for the second.
But I'm quite sure to be able to release at least the first for the next version.