[Closed] Bug in Event Handlers
If you define an event handler as:
on spinner changed true do
(
stuff
)
it’ll modify the variable “true” instead of kicking up an error.
So I had a variable “true” inadvertantly defined as an integer, which shouldn’t be possible.
a bug… user error? not sure which. It’s a scoping issue.
In the listener:
true = 5
-- Cannot assign to read-only variable: true
but:
(
true = 5
print true
)
5
5
So in a scope, you’re setting a local variable, true, to a value.
Wow… that’s fun…
(
tn = false;false = true;true = tn
if not true then
(
format "%:%
" true false
)
)
Imagine the choas…
You can create statements that are true when NOT true… ha ha… forget encrytion, just write your scripts to not work and other people will never figure out how it does…
Adventures in realllllllly wonky code.
rollout bob "bob"
(
checkbox true "spinner"
on true changed true do
(
if true == false then
(
print "True Equals False which equals a checkbox..."
)
else
(
true = "Not false"
print true
)
)
)
createdialog bob
Pretty much the possibilities are endless. You can even redefine undefined and just about any built in function… as another function
(
false = true
undefined = false
array = #(5,3,2,1,4)
sort = "oops"
box = "ohno!"
maya = "the other app"
max = maya
fn box =
(
print "hello"
sphere()
)
fn sort sort =
(
print "Just so you know. True == False and undefined == false which actually equals true"
box()
)
if true == false and true == undefined and max == maya then
(
sort array
)
)
Print "What should Happen:"
sort #(5,3,2,1,4)
I think the official term for this is operator and function overloading and can be done in at least c++ don’t know about other programming languages… but true = false… i don’t know… :hmm: I read somewhere the c++ inventor wanted to make it possible to overload a space ” “… can you think of the posibilities and the total chaos when that happens…
-Johan