On Tue, Nov 4, 2014 at 9:28 AM, Joshua Hoblitt <jhobl...@cpan.org> 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.
>
>
The error would have to be at runtime, so puppet parser validate would not
uncover these kinds of issues (except perhaps in trivial cases where it
could be done). I have an experiment for creating a type inference system,
but it is no where near complete enough to be a static type analysis system
for puppet 4, and even then it would have to give up in far too many cases
without yet more changes to the language.


> -Josh
>
> --
>
> --
> 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/54590CCE.1030305%40cpan.org.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrew Parker
a...@puppetlabs.com
Freenode: zaphod42
Twitter: @aparker42
Software Developer

*Join us at **PuppetConf 2015, October 5-9 in Portland, OR - *
http://2015.puppetconf.com
*Register early to save 40%!*

-- 
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/CANhgQXuoq8%2BZW_%2BcqYSsU5cYS7vs%2Be%2B0nxNJZzuU_n%2BHP_p1JA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to