#62 ✓resolved
David Cox

Truncation and Type declaration versus Type Inference for Defaults

Reported by David Cox | October 18th, 2010 @ 03:13 PM

We ran into a few bumps recently on a newly upgraded system wherein default variable value were getting truncated because the variables were "declared" as integers (the default), but were given a non-integer default value (e.g. 0.5).

There was an appropriate warning (though these are always easy to miss), but I'm wondering if the "correct" behavior shouldn't be to respect the inferred type of the default value, and warn if it is at odds with the "declared" value, rather than respecting the declaration and overriding the default. At the very least, if we are going to respect the declared value, it probably should be an error, since fractional numbers truncate to 0, leading to subtly strange behavior.

Clearly, MW variables are internally dynamically typed, and it's not 100% clear why we put a type field in the XML in the first place (I think that the original idea was that this could inform how the UI looked; e.g. display increment/decrement buttons, that sort of thing).

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The core framework and supporting libraries for the MWorks Suite

People watching this ticket

Pages