PDA

View Full Version : unique udt-variables



ReneMiner
13-02-2016, 10:58
very short:
I want to have global udt-variables that are unique of a kind as currently:


Type tmyUDT
propertyX As Byte
Function _Create()
'...initialize...
End Function
End Type
Global myUDT As tmyUDT


imagine like this:


Type Unique myUDT
propertyX As Byte
Function _Create()
'...initialize...
End Function
End Type
' myUDT is a global variable now already.
' no array possible
' no other variable of same type shall exist
' none shall Extends it

keyword UNIQUE already available for ARRAY-functions,

also thinkeable syntax:



Type myUDT [Global |] Unique

reason & purpose for this:
script-unit-types, enumerations, really unique globals as TBGL_Window, Mouse, Keyboard etc.

Charles Pegge
13-02-2016, 13:56
This is possible in Oxygen, which allows static properties and methods to be accessed using the class name, without requiring an instantiation:



class vv
static float x,y,z
method show
print x
end method
end class

vv.x=34
print vv.x 'property
vv.show 'method

ReneMiner
13-02-2016, 14:30
in thinBasic a problem currently would be having static udt-subelements that are not of primitive numeric type but other udts or dynamic strings i guess.

______________________________________________________

Unique Needed Individual Type :



Unit Keyboard
' all values & methods that belong to keyboard
' accessible via Global
' Keyboard.<property>
' and within Unit : Me.<property> : End Unit
' ...
End Unit