On Wed, Jun 25, 2014 at 5:27 AM, Trevor Vaughan <[email protected]>
wrote:

> Henrik,
>
> Just got done reading through this and it looks quite useful.
>
> I do have a common use case that I'd like to see incorporated if possible
> though.
>
> I would like to have users be able to input either a String or an Array
> into many variables and have String instances auto-cast to a single unit
> Array.
>
>
You can do something like that right now. The type of the parameter is
Variant[String, Array[String]], then once you get the value you need to
convert that into a common type. For that kind of a thing, I think there
would be a function to convert the type, but I'm not sure that we would put
such a function inside puppet itself.


> This would allow me to simplify code where I either have to cast the
> variable myself or have an if/else chain to do different things based on
> the input type.
>
>
We've made the decision that puppet will try to have as few surprises as
possible in the language and so auto-conversion of values between types is
kept to a minimum. The only one we really have right now is
Numeric<->String and stringification in string interpolations.


> Thanks,
>
> Trevor
>
>
> On Wed, Jun 18, 2014 at 11:38 AM, Henrik Lindberg <
> [email protected]> wrote:
>
>> On 2014-18-06 3:45, Henrik Lindberg wrote:
>>
>>
>>> I am working on a blog post to cover the new type checking features and
>>> the various ways they can be used - either "automatically" by declaring
>>> parameters as typed, or by using the assert_type function when the
>>> declarative approach is not enough. (Hope to have the blog post ready in
>>> a day or so) - it will appear as part of the type system blog posts -
>>> i.e. indexed from this page:
>>> http://puppet-on-the-edge.blogspot.se/2014/02/the-
>>> puppet-type-system-blog-posts.html).
>>>
>>>
>> Just off the presses..
>>
>> http://puppet-on-the-edge.blogspot.se/2014/06/
>> optionally-typed-parameters.html
>>
>>
>> --
>>
>> 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 [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/puppet-dev/lnsbqa%241bh%241%40ger.gmane.org.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Trevor Vaughan
> Vice President, Onyx Point, Inc
> (410) 541-6699
> [email protected]
>
> -- This account not approved for unencrypted proprietary information --
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoW80U_HHJmXEW9rpGKQ_Us_K4evmCMhxqcN-JrxqdTLKw%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoW80U_HHJmXEW9rpGKQ_Us_K4evmCMhxqcN-JrxqdTLKw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrew Parker
[email protected]
Freenode: zaphod42
Twitter: @aparker42
Software Developer

*Join us at PuppetConf 2014 <http://www.puppetconf.com/>, September
22-24 in San Francisco*
*Register by May 30th to take advantage of the Early Adopter discount
<http://links.puppetlabs.com/puppetconf-early-adopter> **—**save $349!*

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CANhgQXtz8ohUho28Ca3v6UTO7CZrvLUiz8gw9J1_Z8Z5KzCAxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to