lexikos wrote:I suppose that "the quirk of numxxx in v1" is that it differentiates between the value x and a variable containing value y when x and y are exactly the same value and type. SendMessage doesn't do that.
The quirk, for the caller, is that it has a variable which contains what it wants to pass to the function, but it cannot pass its variable reference, it has to make an (supplementary) expression (
-0). SendMessage now presents the same quirk (
&) for the caller. Every now and then, someone has a variable containing a string which looks like a number, this person should realise it is an illusion and convert it to an actual number if it wants to pass it (to sendmessage) as such, it will benefit the person for several reasons. Fundamentally, if you have
"1" in your variable when you want to pass
1, you have the wrong value in your variable. It makes no sense to supply a built-in function with information about a variable instead of passing it directly, cf.,
Code: Select all
strsplit(&str, &del, isobject(type(del))) ; ?
The vast majority of built-in function parameters either 1) accept a string or number and convert it to a string, or 2) accept a number or string and convert it to a number. SendMessage's wParam and lParam are now included in that majority.
There is no denying the fact, and as I said, or hinted, earlier, I am opposed it. AHK v2 variables distinguishes well between numbers and strings, there is no need (for the program) to ever treat a string as a number. If AHK is not going to throw exceptions on using strings in math functions / operations, it has no future, it is utterly ridiculous to produce an empty string instead of notifying the user of an obvious mistake, it is very dangerous to produce numbers from strings. How can this be acceptable?
Code: Select all
; User makes an obvious mistake
var := "01"
msgbox type(var) ; String
msgbox var+1 ; Non-sensical result, 2
Furthermore, the address operator (
&) is
inconsistent,
&(var:="1") should obviously return an address of an integer, not a string.
"1" is a number, anyone can see it is (
).
Anyone sending a standard window message should read the documentation for that message before doing so.
Of course,
after one has read the documentation on how to use the built-in function.
Cheers
.
(I do not mind being sligthly hyperbolic)