I think that I will start moving to file all of my bug/error/oversight complaints in blog entries. This way (in theory), they are more easily indexed on this site. So, I was playing around with a procedure today: [>restart; testproc:= proc(Q::`=`) local a; ##IF STATEMENT## return a; end proc: [> The if statement noted in the procedure always took on the following appearance: if #Check if lhs(Q)=a# then #assign rhs(Q) to a#;fi; Writing my procedure as above ensured that the restart would be executed every time I changed my if statement. My first if statement went like this: if lhs(Q)='a' then a:=rhs(Q);fi; And the output from testproc(a=5)? Just a. 'a' was not assigned. Okay. Maybe the if statement is not being run? Let's check with a new if statement: if lhs(Q)='a' then lprint("Hello World!");fi; Run testproc(a=5) again, and no lprint line. Fooey. This just shows that evalb() is increadibly weak. On to verify! if verify( lhs(Q), 'a', symbol ) then a:=rhs(Q);fi; Run testproc(a=5) again, and the output is indeed 5. Success! Now, let's try playing around with this. if verify( lhs(Q), 'a', symbol ) then `:=`(a,rhs(Q));fi; Run testproc(a=5) again, and the output is a. WHAT?? I know that the verify() statement is working properly; so, this must mean that the `:=`() statement is not working properly. Bad bug. Let's try somethign else: if verify( lhs(Q), 'a', symbol ) then assign(a,rhs(Q));fi; Run testproc(a=5) again, and the output is 5. Yay! Now, let's try being a little more interesting: if verify( lhs(Q), 'a', symbol ) then lhs(Q):=rhs(Q);fi; Run testproc(a=5) again, and Error, (in testproc) invalid left hand side in assignment. Dang. Turns out, this happens if you try to do it in the worksheet, too: [> QQQ := q=4; [> lhs(QQQ) := rhs(QQQ); Error, invalid left hand side in assignment [> I don't have any idea why this error would be coming up; the left hand side of lhs(QQQ) := rhs(QQQ) is a symbol, which is acceptable to := . Anywho, on to another variation: if verify( lhs(Q), 'a', symbol ) then `:=`(lhs(Q),rhs(Q));fi; Run testproc(a=5) again, and the output is a. Same as before :( Oh, and don't tell me that `:=`(foo,bar) does not assign bar to foo; I can't get it to work in Worksheet mode, but it works seamlessly when I pipe commands from a text file into TTY Maple. Finally, the truely horrific bug that caused me to write this blog entry: if verify( lhs(Q), 'a', symbol ) then assign(lhs(Q),rhs(Q));fi; Run testproc(a=5) again, and the output is a. Boo, Maple's being bad; however, here's the rub: [> testproc(a=5): [> a; 5 [> When this particular if statement is in my procedure, the local variable a is not assigned a value, but the global variable a is assigned a value. This is extremely dangerous! I imagine this bug has come about because the lhs of the argument has some sort of global binding, and assign() decides to ignore the fact that it is inside of a procedure with a local variable a. --Schivnorr P.S. No one's bothered to check out my last bug post? P.P.S. There is a typo in the help page for assign(). In the last paragraph under the Details section, it states "Whenever an assignment is made to a local variables with such a type assertion..." Either the "a" needs to be dropped, or "variables" needs to be singular.

Please Wait...