Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Re: Change variable type

31 views
Skip to first unread message

Christopher Allen

unread,
Jan 7, 2025, 11:19:33 AMJan 7
to blo...@googlegroups.com
Hi Adrian,

Theres no function or way to change variable types. If there is can someone guide me on how to do it?

The .type is a public, non-readonly property of VariableModel.  As far as I am aware you can change the type of a variable by getting its model and directly mutating this property—though I can't promise that this won't have some surprising consequences; notably, this will not cause any connection checks to be done, so you may find that a previously-valid program has become invalid due to now-illegal connections.


Christopher

Christopher Allen

unread,
Jan 8, 2025, 1:30:07 PMJan 8
to blo...@googlegroups.com
Hi Adrian,

Following up on my previous reply: 
The .type is a public, non-readonly property of VariableModel.  As far as I am aware you can change the type of a variable by getting its model and directly mutating this property—though I can't promise that this won't have some surprising consequences; notably, this will not cause any connection checks to be done, so you may find that a previously-valid program has become invalid due to now-illegal connections.

I am informed by one of my colleagues that in fact there are several other issues that will probably prevent this from working correctly, including various other places that variable types are stored (and which would need to be updated when the type was modified.

Her exact words were "we do not support changing the type of a variable", so I must now update my advice to recommend your original approach of deleting the variable and recreating it.


Apologies,

Christopher
Reply all
Reply to author
Forward
0 new messages