Geppetto complains about uninitialized variables in reduce function

74 views
Skip to first unread message

Igor Berger

unread,
Dec 17, 2013, 11:23:34 AM12/17/13
to puppet...@googlegroups.com
Hello,

I'm using the following expression to format a list:

        $valid_environments = ['env1', 'env2', 'env3']
        $env_message = $valid_environments.reduce |$message, $env| { "${message}, ${env}" }

It works at run-time (Puppet 3.2.4 standalone with "--parser=future").

However in Eclipse (v4.3.1), Geppetto (v4.0) shows these errors:

        Reference to not yet initialized variable: env'
        Reference to not yet initialized variable: message'

The workspace Puppet target version is set to "future".

Is there another syntax I could use to make Geppetto happy or is this a bug?

Thanks,
Igor.

Henrik Lindberg

unread,
Dec 17, 2013, 7:13:15 PM12/17/13
to puppet...@googlegroups.com
That looks like a bug. Please report it here:

https://tickets.puppetlabs.com/browse/GEP

The errors are for the case when there are parameters to a class or
define and the default value expression references one of the other
variables - i.e. something like this

define foo($a = $b, $b = 3) { }

So, something is amiss with the validation for a lambda. I assume you
have turned on the "future" under Puppet Target.

Regards

- henrik

Igor Berger

unread,
Jan 9, 2014, 11:45:36 AM1/9/14
to puppet...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages