Re: [Puppet-dev] The string to number torture never stops

2014-11-03 Thread Thomas Hallgren
On 2014-11-02 10:19, Joshua Hoblitt wrote: # best effort, or fail convert_to(Number, value) It would require changes to the lexer but another syntactic option (not that I'm advocating it) would be C style type coercion. (String)$my_hungarian_integer I perceive this as a type cast, not a

[Puppet-dev] Re: The string to number torture never stops

2014-11-03 Thread John Bollinger
On Friday, October 31, 2014 8:22:36 PM UTC-5, henrik lindberg wrote: [...] Yet again someone was bit by the automatic String to Numeric conversion that is in Puppet (and also in --parser future). I must confess to a certain dark amusement at Puppet struggling with its weak-typing legacy

Re: [Puppet-dev] The string to number torture never stops

2014-11-03 Thread Joshua Hoblitt
On 11/03/2014 02:09 AM, Thomas Hallgren wrote: (String)$my_hungarian_integer I perceive this as a type cast, not a conversion, and would expect a runtime exception unless $my_hungarian_integer already is a string. Welcome to the magic of C. The type casting syntax is both a way of explicitly

Re: [Puppet-dev] Re: The string to number torture never stops

2014-11-03 Thread Joshua Hoblitt
On 11/02/2014 05:34 PM, Henrik Lindberg wrote: On 2014-02-11 10:19, Joshua Hoblitt wrote: On 11/01/2014 03:35 AM, David Schmitt wrote: On 2014-11-01 01:22, Henrik Lindberg wrote: The requirement to compare strings and numerals can also be implemented by converting the numeral to a string

Re: [Puppet-dev] The string to number torture never stops

2014-11-03 Thread Thomas Hallgren
I know that primitives are converted by casts in may languages but most of them (if any) would not classify string as a primitive. I think we should refrain from this kind of magic since it's less clear what it will do. Anyone familiar with C++, C# or Java will probably perceive a string cast the

Re: [Puppet-dev] The string to number torture never stops

2014-11-03 Thread Daniele Sluijters
Agreed. This is a tool that 'ops' people should also be able to use and not require a black belt in C type casting or an understanding of the parser to figure out when a string is actually a string and will be treated as such. On Monday, 3 November 2014 22:06:03 UTC+1, Thomas Hallgren wrote: