Xojo Constants

@anon81583535
Since I cant post in the Xojo forum I can start a thread here

Constants can have a type of Number (see below), String, Boolean, Color or Text.

Yes - when you define one in code you can define the specific type
The constant editor behaves more like you are using the style

Const foo = 10.0
Const bar = 10

with no specific type set

Being able to explicitly state the type was only added relatively recently
https://docs.xojo.com/Changes_2014r3
3317 Compiler: Locally scoped constants can now have an explicit type.

But only an explicit type in your code. But not for a module property (except the trick Karen mentioned on the Xojo forum)

The release note there explicitly says only in your code as well

When you used the constant editor in the IDE it behaved more like the code that would result was

 
     Const foo = "string"

It didnt generate code with an explicit type
It could probably be made to write explicit types
Time for a feature request so it does that

Interestingly enough Constants are one of the few places in Xojo, if not the only place, where the type was inferred from the data
It was rare that you needed to be able to force a specific type
Often that was “oh it needs to be an int64 explicitly instead of integer” for some other code