So types don't matter?
I anticipated that if I don't declare a type in assignment that it would be variable as to what I assign to it
would be valid. However
int x = 2 x = "foo"
being valid as well surprised me. This lack of validity also works the same way in structs. So is there any type consistency at all in Fuze as it or being planned?
So currently Fuze is very loosely typed. In fact the only reason to add a type is to force local scope or in a struct declaration.
PB____ last edited by PB____
Even though Fuze is loosely typed, I still think it's better to try to be consistent with your code.
If you use
int x, then use
int, even if it's just to avoid confusion.
However, I do myself also use this "feature" on struct instances, when I don't know the type of a property beforehand:
// initialization g = [ .property =  ] function updateProperty() g.property = [ .newProperty = "Hello World" ] return void
This is technically abusing similar flexibility, but I do hope that (or something similar) stays supported, as that provides flexibility that I like..
When it comes to declaring variables, I personally often use a non-existing struct name
var. But this is also not officially supported, so there is a non-zero chance that you need to update your code in the future if you do that. If you want to stay save for now, use the types you know in your variable declarations and stick to them when you assign values.
There may be instances where you don't know the type. For example:
c = controls(0), you might need to scope those variables to a function anyway. I would suggest to use
varin these cases, but if the Fuze team eventually decides that the keyword should be
bob, then there is a risk that
varneeds to change to
bob. So I do hope future Fuze will have good find and replace mechanisms before that day D:
EDIT: disclaimer - the above is my opinion (of a Fuze user), I have no authority at all over the choices of the Fuze team in the programming language, so keep that in mind when you make a choice in how you write your code.
I can confirm that var is going to become part of the language for this purpose
PB____ last edited by
That's great news, thanks! :-D