Issue #3124 has been updated by Henrik Lindberg.
Actually:
'declare' typically means a declaration of existence (most commonly name and
type).
'definition' typically means everything required to instantiate, sometimes this
is by use of some body, or by assignment.
In puppet declaration and definition is typically done at the same time.
`define foo { ...}` both declares that there is a defined resource type called
'foo' and what it does. It is not possible to just declare that foo exists.
`$a = 10` both declares that the variable $a exists in this scope, and defines
that it has the value 10.
If puppet actually had declarations, it would be possible to ask
`declared($someuserfact)`. This is not possible as it is only possible to check
if a particular variable is defined (i.e. has a value). You can not check for
"potentially has a value" - i.e. 'it is a valid fact in some scope' as opposed
to 'is defined to have a value at this moment in time'.
The terms 'define' and 'declare' does not really have anything to do with a
language being 'declarative' vs. 'imperative' - both types of languages can
have both declarations and definitions.
Since the 'defined' function has been around for some time, it is not really
practical to change it, and it actually does check for definition even if its
description says it is checking for declaration :) I think this issue can be
closed with a won't fix.
----------------------------------------
Refactor #3124: core function defined, should be called declared.
https://projects.puppetlabs.com/issues/3124#change-73203
Author: Dan Bode
Status: In Topic Branch Pending Review
Priority: Normal
Assignee:
Category: language
Target version: 2.7.x
Affected Puppet version: 0.25.3
Keywords:
Branch: https://github.com/nanliu/puppet/tree/ticket/2.7.x/3124
I am working on hammering definitions/semantics for how we talk about Puppet.
For this case, clarifying how we use define vs. declare.
Defined resource types are defined.
resources and variables are declared. (since its a declarative language, we
declare things)
The name of the core function 'defined' is not consistent with this naming
convention, it should eventually be changed to 'declared'. According to the
above mentioned terminology, it actually checks that things are declared and
not defined(or in the case of classes, included).
--
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.