Don't allow hyperscript zoo symbols to be overwritten
When creating a hyperscript function, need to provide better compiler errors to let the developer know not to use zoo symbols.
When defining a function, I was using the variable my when I should have used elt or something like that.
The following function:
def toggleVisibilityBy(my, source, target, value) set selector to my.id.replace(source, target) if my.value == value add .hidden to #{selector}.closest("tr") else remove .hidden from #{selector}.closest("tr") end end
Should really look like the following:
def toggleVisibilityBy(elt, source, target, value) set selector to elt.id.replace(source, target) if elt.value == value add .hidden to #{selector}.closest("tr") else remove .hidden from #{selector}.closest("tr") end end
Thanks!
I agree there should be an error or warning when using reserved symbols as function arguments, and maybe other possibly conflicting contexts. I learned this the hard way after wasting about half an hour wondering why an argument kept being null, without realizing target is also a zoo symbol in def my_func(elt, target, args).