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: > >

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 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 exp

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 conve

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

2014-11-02 Thread Joshua Hoblitt
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 (using a canoical > non-locale dependent format). This produces a much safer route, as > cre

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

2014-11-01 Thread Trevor Vaughan
I was also bitten by this during testing and it made the thought of converting my code to 4.0 daunting. So, I am very much not a fan of automatic String to Number conversion. Thanks, Trevor On Sat, Nov 1, 2014 at 11:39 AM, Kylo Ginsberg wrote: > On Sat, Nov 1, 2014 at 3:35 AM, David Schmitt

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

2014-11-01 Thread Kylo Ginsberg
On Sat, Nov 1, 2014 at 3:35 AM, David Schmitt wrote: > On 2014-11-01 01:22, Henrik Lindberg wrote: > >> Somehow fitting, Halloween and all... for what I want to bring up. >> > > Indeed. Cross type interactions are the worst. > > Yet again someone was bit by the automatic String to Numeric conver

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

2014-11-01 Thread David Schmitt
On 2014-11-01 01:22, Henrik Lindberg wrote: Somehow fitting, Halloween and all... for what I want to bring up. Indeed. Cross type interactions are the worst. Yet again someone was bit by the automatic String to Numeric conversion that is in Puppet (and also in --parser future). The particula

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

2014-10-31 Thread Henrik Lindberg
F.Zappa - excerpt from "The Torture Never Stops": "Flies all green and buzzin' In the dungeon of despair Who are all those people That he's locked away down there Are they crazy Are they sainted Are they zeros someone painted That had never been explained Since at first it was created Bu