Add support for single line assignment for arrays inside UDT
issueid=330 30-10-2011 08:27
thinBasic author
Number of reported issues by ErosOlmi: 35
Add support for single line assignment for arrays inside UDT

Issue Details
Issue Number 330
Issue Type Feature
Project thinBasic
Category Core engine (thinCore.dll)
Status Suggested
Priority 5 - Medium
Suggested Version 1.8.9
Implemented Version (none)
Milestone (none)
Votes for this feature 2
Votes against this feature 0
Assigned Users (none)
Tags (none)




08-03-2012 20:42
Junior Member
Can i Redim array of UDTs inside UDTs?
For example:
type t1
aa as long
bb as single
end type

type t2
num as dword
objs(1) as t1
end type

dim my_obj as t2

my_obj.num = 1000
my_obj.objs(1).aa = -10
my_obj.objs(1).bb = -10.0

redim preserve my_obj.objs(10) ' Why whis doesnt work

08-03-2012 21:56
thinBasic author
Hi Asper,

the problem with UDT is that they are, by their nature, fixed memory structures defined before runtime starts. In compilers they would say "UDT are defined at compile time".
That's why it is not possible to REDIM arrays inside UDT: the interpreter (or the compiler) must know the UDT size before execution.

From my point of view, I like to have as much freedom as possible and that's why I will reply to you that I will accept this request as possible implementation.
In any case consider that UDT with dynamic structures inside them will break backward compatibility with Operating System API or in general with functions that expects fixed memory structures with a fixed and known size.

In any case this implementation is not something that can be ready very soon.

Ciao
Eros

09-03-2012 06:34
Junior Member
thanks a lot. I wil try another way.

+ Reply