On Tue, Aug 2, 2011 at 07:22, Ken Barber <[email protected]> wrote:
>> I think you nailed the point of complexity there: our current language
>> support doesn't do what we need, and kwalify is probably the best
>> choice for a validation language right now.
>>
>> My major concern around this is that separate schema and class make it
>> hard for folks to keep them in sync; I know when I was doing Win32
>> development and we needed to maintain a separate "export" file next to
>> our code, the most common failure was to forget to update that.
>>
>> I would ideally like to see this integrated as part of typing in the
>> language, so you would express constraints when you declare the
>> parameters to your class or define. That would give the assurance
>> that both were always consistent, and have only one place to view the
>> data.
>
> Well one workaround for keeping the file in sync is to have code that
> does a comparison on the top level between arguments and the schema
> and throw an obvious error if they are not. At least then its caught
> at runtime.
>
> But I do feel your sentiments ... Java went through this same exercise
> with CMP. In the end I believe they moved a lot of the logic to
> annotations inside the Java code to avoid the double file exercise.
*nod* Multi-file systems seem to be long term troublesome.
> You could in theory transfer kwalify-like specification to the
> language ... here is a quick hack for discussion:
>
> class bind (
> $options => {
I imagined it being in the body, and calling a method, until we added
syntax, but either way would work. Mostly, I figure any solution lets
us figure out how well Kwalify is a match for our real-world needs.
> Of course bind has hundreds of options ... so this would get large ...
> but at least its all in one file.
Yeah. An external file would also be large; that bit doesn't change, really.
Hrm. Possibly using an explicitly scoped variable beside the class
declaration might be a way to get this into the language without so
much impedence mismatch in where you land the data?
$example::nested::class::options = {...}
class example::nested::class { ... }
>> I nearly said "kwalify is the least worst choice", because aside from
>> Rx (http://rx.codesimply.com/) it is one of the few validation
>> languages that was both complete enough and simple enough to use. It
>> still felt painful to use, though, in the real world.
>
> Rx looks interesting - I haven't seen it before.
>
> On another point ... I can see the need for handling obvious patterns
> in a re-usable way like in the example above for IPv4. In kwalify this
> would be done with merge mappings:
Yeah. My main concern would be that, like many of these things, Rx
looks to be a mostly dead language. On the plus side, there really
isn't a standard, so...
I guess we can always experiment with both and figure out what works.
Daniel
--
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.