On 2014-14-03 11:48, Erik Dalén wrote:
Not terribly important, but are there any thoughts on making it so you
can order variables any way you like in the manifest? They are immutable
anyway, so these two examples should be equivalent:

$a=1
$b=$a+2

or

$b=$a+2
$a=1

You can put resources in any order you like, so it would make some sense
to be able to do the same with variables. I guess it could pose some
difficulties with functions reading the scope though, but after moving
to epp templates there shouldn't be many of those kinds of functions.


Yes, there has been thoughts about this. It is kind of difficult though...

$a = [1,2,3]
$b = $a.map |$x| { $c + $x }
$c = $b[1]

and the Journey to Prolog begins... (or to a Spreadsheet like language...)

While it is true that resources can be placed in any order, it is important to remember that there are two distinct phases - one that computes the catalog, and one that applies it. The order among resources matter if you want to be able to get an attribute set in one resource while defining another (currently difficult without Ruby function), but this is available in the future evaluator - e.g.

$mode_of_foo_file = File['foo'][mode]

Currently, we have no guarantees that a function call is side effect free - it may create new classes, resources and variables.

I am also not sure if making the language completely lazy makes it any easier for users with the different kind of corner cases (when to stop iterating if there are loops in the logic, how to understand what is wrong in those cases, etc.)

What I think we are opening up for in the 4x series is a far better Catalog model (the end result) thus opening up for interesting language experiments - say a Clojure or Prolog (on JVM) language that builds a catalog. If such an implementation turns out to be fantastic and easy to use / understand, it may take over the world...

Regards
- henrik


--
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 puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/lfv934%24cun%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to