- @Flipeador: Re. WinExist parameters. Sometimes I had hotkeys on Open/Save As dialogs, but where the controls differed, all with the same title and class (#32770). So I needed to use the WinText parameter until ahk_exe came along.
- Re.
maybe we're trying to make AutoHotkey a language that is not
You should have more confidence in your arguments. The consensus on this forum is usually for small changes that maintain or simplify functionality, in line with your ideas. By contrast, nnnik says things that are neither right nor wrong, but that usually involve some paradigm shift, and would end up with everything in AutoHotkey being completely different. I would welcome a full report on nnnik's ideas, it's hard to keep track of the proposals.
- @nnnik: You appear to be getting things backwards. I don't think I've ever seen strings used like this in a script:
SendMessage, 0xC, 0, "New Notepad Title" ; 0XC is WM_SETTEXT
The only argument for letting SendMessage do something like this is for 'convenience'. However the real convenience lies in commands like WinSetTitle/ControlSetText.
- If the argument is to be newbie-friendly. Consistency and predictability are the key. Passing numbers one way with success (as numbers), and another way with failure (as strings), in a way that works on all other functions. Not newbie-friendly.
- When people use numbers (stored as strings) they often do so without realising it. Why? Because numbers stored as String/Integer types are interchangeable in AHK v1 for SendMessage. Because it's never been a problem before, I've never looked at other people's scripts to see if they pass numbers stored within strings before. I've done a lot of debugging, and a lot of conversion, looking to see if a variable was defined as a string or integer, not nice.
- Passing numbers as strings is something I've done regularly, particularly when parsing parameter lists.
- I haven't found the automatic variable resizing to be sufficiently useful as an argument, and sometimes I *don't* want it to occur, so it's a disadvantage. I'm fine with doing a VarSetCapacity line. Also, unpredictable behaviour like this led to some bugs in some scripts I had.
- When I see variables without the &, I think, is that the variable's contents or address being passed. That's why I like to see the &, always. I added it in to all of my scripts and libraries.
- I'm very surprised at your objections to the concept of pointers. One of many uses is to store object references when looping through an object hierarchy. How do we solve that?
- @derz00: Re.
That is, rather, an inconsistency of AutoHotkey. In more consistent languages, "str"+0 would raise an error.
- You're using the word 'consistent' to mean 'normal' (perhaps based on your own programming prejudices, something we all have). AutoHotkey is consistent. There were good reasons that AutoHotkey chose this route, maybe AutoHotkey was right.
- As was pointed out, "str"+0 causes an error in AHK v2. Anyhow, both AHK v1 and AHK v2 have some type specification and differentiation functionality, and I'm glad they do, but for most functions it's better to ignore types.
It is easy for anyone to miss the real reason for a bug. Usually this skill comes with much time and sometimes training.
- This and other points read like 'I know every programming language ever, and have experience with every programming language, therefore I can inform you ...'. Which I usually interpret as 'I know Python, and Python does it differently'. I think it's reasonably common in C++, AutoHotkey and other languages, for a bug to occur, and for the reason to be unclear, especially for something that worked in AHK v1, but not in AHK v2 (which is still in alpha by the way). I generally welcome your posts, and of course, if your post was more information-laden, I might be more swayed by the arguments.
- @Helgef: Re.
"quotedString" + 0 actually is an error, but not
varContainingString + 0
The handling of object keys in AutoHotkey would collapse without this. I would not be against functions like MakeString or MakeNum, although "" and +0 are nicely short.
- Re. 'fallback', in my view, NumGet/NumPut should accept either Addr or &Var. If you have 'Var', when what is meant is '&Var', NumGet/NumPut could check whether Var is a numeric or string type that contains a number, if not, it could pass its address (to allow older scripts to remain functional in AHK v2).
- Very nice, I like your Jee_Numget function muchly.