I noticed rhino supports the const keyword, however if I try to use it in a global definition servoy becomes quite unhappy and sees it as a syntax error. Is the support already in Servoy and I'm perhaps not assigning it correctly?
- Code: Select all
Ryan-Parrishs-MacBook-Pro:~ rparrish$ rhino
using CLASSPATH=/usr/local/bin/rhino/*:/usr/local/rhino1_7R2/*
Rhino 1.7 release 2 2009 03 22
js> const test_constant = 12345
js> test_constant
12345
js> test_constant = 54321
54321
js> test_constant
12345
js>
Of course the ECMAScript implementation of constants leaves a bit to be desired, I would much prefer it to throw an exception in the event something tries to re-assign the value, much like every other language that supports constants that I can think of right now, but we take what we can get I guess.