Re: Constructor or equivalent for "Global Variables" in libraries

2016-10-26 Thread Michael Lasevich
Yeah, I would expect it to work as well, but it simply does not. It is probably something to do with either the way this is loaded or CPS, we have already seen that CPS has hard time handling some basic Groovy concepts like getters/setters - I was just hoping I was missing something obvious

Re: Constructor or equivalent for "Global Variables" in libraries

2016-10-26 Thread Martina
In a big standalone groovy I have class myClass { List myList = [] public myCall (item) { myList.add(item) } } I am pretty sure I have used it without the class stuff in smaller snippets. Martina On Wednesday, October 26, 2016 at 8:54:59 AM UTC-6, Michael Lasevich

Re: Constructor or equivalent for "Global Variables" in libraries

2016-10-26 Thread Michael Lasevich
No dice, groovy.lang.MissingPropertyException: No such property: myList for class: myListTest -M On Wednesday, October 26, 2016 at 7:42:19 AM UTC-7, Martina wrote: > > Try the following: > > myList = [] > > > def call(item){ > myList << item > } > > Martina > > On Wednesday, October 26,

Re: Constructor or equivalent for "Global Variables" in libraries

2016-10-26 Thread Martina
Try the following: myList = [] def call(item){ myList << item } Martina On Wednesday, October 26, 2016 at 12:24:48 AM UTC-6, Michael Lasevich wrote: > > So, what is the proper way to initialize the fields in the "Global > Variables" found in the /vars dir in library code? > > I know it is

Constructor or equivalent for "Global Variables" in libraries

2016-10-26 Thread Michael Lasevich
So, what is the proper way to initialize the fields in the "Global Variables" found in the /vars dir in library code? I know it is supposed to be a singleton instantiated on first call, and I know I can SET new fields by just setting them, but what if I want them to have default value when