Issue #6784 has been reported by Pieter van de Bruggen.

----------------------------------------
Bug #6784: Puppet::Interface.new should be #interface
https://projects.puppetlabs.com/issues/6784

Author: Pieter van de Bruggen
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


The code currently implements Interface creation as:

    Puppet::Interface.new :name do ... end

There are implicit behaviors that create entries in the namespace for the newly 
created Interface, and the instance returned by `Puppet::Interface.new` is not 
actually useful.  While this makes sense from an (English) grammatical 
perspective, `[Class].new` is expressly intended to create a new instance of 
something, to be stored in a variable and manipulated later.

Since `Puppet::Interface.new` is not actually creating an immediately useful 
instance, it is likely more correct to say something like:

    Puppet::Interface.describe :name do ... end

If `Puppet::Interface` is not a `Class`, but a `Module`, then this interface 
becomes feasible:

    include Puppet::Interface

    describe :name do ... end

Since what's being `describe`d could be considered ambiguous, and the intent of 
the method is to set up a new interface:

    include Puppet::Interface

    interface :name do ... end

seems to make the most sense.

In combination with issue #6783, we could automatically include 
`Puppet::Interface` into the sandbox so that interface declaration is simply:

    interface :name do ... end

Note that this does not introduce any change in semantics from 
`Puppet::Interface.new`.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to