On 2014-04-11 18:28, Joshua Hoblitt wrote:
On 11/04/2014 09:46 AM, Henrik Lindberg wrote:
It is a bit difficult since operators are overloaded on type. The good
part is that if we stop transforming strings to numbers there will be
errors for arithmetic expressions.

The bad part is that ==, != cannot raise errors (since a string is
simply not equal to a number). Currently comparisons order all numbers
to be smaller than all strings. We could change those to instead error
if the types are not comparable to each other.

I think raising an exception when the types of operands to a comparison
operator are different is the least surprising behavior absent automatic
type conversion.

It would also provide at lot more confidence that a manifest is 4x safe
if it passes `puppet parser validate`.  Without that you'd have to worry
about conditional expressions silently changing their result between 3x
and 4x.

Remember though, that validation cannot catch results of functions and expressions - since the validation is static, and we cannot really do reasonable quality type inference (at least not yet).

- henrik

-Josh

--



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/m3bfr7%245j9%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to