- BIVs, Subcommands, StdLib, Settings:
Imho,
AHK. > A_ !
But, even more
win.move > winmove
and finally,
win.titlematchmode > AHK.titlematchmode
so, in effect, AHK would be truncated to some directives (in this form not so interesting).
What? I'd prefer namespaces (or objects) win, math, gui, str, ... whenever they arise naturally. Then, one could use different settings side by side:Code: Select all
win2 := win.clone() win2.titlematchmode := "regex" win2.detecthiddenwindows := "off" win2.close("title1|title2")
- Variables:
Imho it is good that an "undefined" var bahaves like an "empty" var, that is a var that is freed according to the rules of the language.
Now, ahk is like arithmetic before the invention of the 0, and, uses the empty string for this purpose (maybe not ahk-internally, but in the script it looks like that). Hence, it'd be consistent that an "undefined or free" var behaves exactly like an empty string (which is a string imho).
On the other hand, after the invention of a reserved "undefined or free" type one should cast it for (almost) all operators or for none, everything in between only fills the support forum. Imho one should cast, as it would reduce the abuse of the ternary operator to circumvent a simple var "start-assignment". - Misc:
I've no doubt that it will work, but it is imho very quirky:
(1) Comma operator and command syntax (to be found in v1 and v2)
(2) Built-in functions, some returning !ErrorLevel and others not.
If the comma operator returns the right-most operand (which was at least discussed), then this mechanismis much clearer than (2).Code: Select all
actually_I_am_interested_in_the_ErrorLevel := (function(args), ErrorLevel)
return ErrorLevel from functions
return ErrorLevel from functions
EDIT: The friendly splitting mod/admin did not even marked this topic as being a topic split. And as coincidence(?) the subject (-header) turns out to be related to a topic I've recommended to neglect at least two times. Lol, obedience over capacity?
Last edited by strobo on 11 Mar 2014, 07:21, edited 3 times in total.
Re: v2-thoughts Discussion
I disagree.strobo wrote:But, even more
win.move > winmove
I think that's an interesting idea, but not suitable for AutoHotkey. If you think the idea has merit, you could implement it as a script library.Then, one could use different settings side by side:
Variables: I understood little of what you tried to say in this part of your post. "Undefined or free" variables contain an empty string. This will not be changed. However, use of uninitialized variables can be detected using the #Warn directive.
(1) What about it? Quirky how?
(2) This is not quirky. All built-in functions which set ErrorLevel to a boolean value will return !ErrorLevel. It would not be useful for all functions to return !ErrorLevel. It is not logical to imply that all functions in a library should return the same value - different functions have different purposes.
I disagree. How do you know what ErrorLevel means? Either you read the documentation (which would also say what the return value is), or you assumed (maybe incorrectly) that the function follows the common pattern of ErrorLevel=0 for success and ErrorLevel!=0 for failure. Another common pattern is for a function to return true on success, false on failure. Now functions which followed the former pattern also follow the latter pattern. IMHO,actually_I_am_interested_in_the_ErrorLevel := (function(args), ErrorLevel) is much clearer than (2).
Code: Select all
if WinSetTransparent(N, Title)
MsgBox success
Code: Select all
if (WinSetTransparent(N, Title), ErrorLevel)
MsgBox failure
Re: v2-thoughts Discussion
@Variables
IIRC (sorry if not),
fincs: non-numerics --> 0
just me: empty var contains empty string --> throw exception (math operator context)
strobo: all the same to me, but keep it consistent.
I mention it because last time I checked,
@(1)
IIRC v2 has even more corner cases than v1, when it comes to interpreting a whole code-line as expression (due to command-syntax). My reference to the comma-operator was misleading because other operators are affected as well.
@(2)
I am not assuming anything about ErrorLevel. I am not suggesting that functions should not return meaningfull values. Maybe I should just extend the example
The user should be able to guess the meaning of the return value from the function name and not from knowing whether ErrorLevel is boolean. Frankly, the difference is maybe to subtle to have many real world consequences.
IIRC (sorry if not),
fincs: non-numerics --> 0
just me: empty var contains empty string --> throw exception (math operator context)
strobo: all the same to me, but keep it consistent.
I mention it because last time I checked,
Code: Select all
msgbox,% ++p ; blank
++p
msgbox,% ++p ; 2
a := {}
msgbox,% ++a[1] ; blank
++a[1]
msgbox,% ++a[1] ; blank
IIRC v2 has even more corner cases than v1, when it comes to interpreting a whole code-line as expression (due to command-syntax). My reference to the comma-operator was misleading because other operators are affected as well.
@(2)
I am not assuming anything about ErrorLevel. I am not suggesting that functions should not return meaningfull values. Maybe I should just extend the example
Code: Select all
actually_I_am_interested_in_the_ErrorLevel := (function(args), ErrorLevel)
I_dont_care_ErrorLevel_I_dont_read_the_docs := function(args)
Re: v2-thoughts Discussion
Such as? I think you're mistaken. Also, your example produces all blank results on v2.strobo wrote:@(1)
IIRC v2 has even more corner cases than v1, when it comes to interpreting a whole code-line as expression (due to command-syntax).
So then you don't know what ErrorLevel means? How then is it clearer to use ErrorLevel via the comma operator? Why are you interested in the ErrorLevel and not the return value?@(2)
I am not assuming anything about ErrorLevel.
They can...The user should be able to guess the meaning of the return value from the function name and not from knowing whether ErrorLevel is boolean.
How could your post be interpreted as pessimistic? The whole point of v2 is that it breaks compatibility.joedf wrote:I don't want to sound like a pessimist. There is great ambition here.
Re: v2-thoughts Discussion
Such as? I think you're mistaken
Code: Select all
p ++
Great news.Also, your example produces all blank results on v2
The guy who don't know ErrorLevel writesSo then you don't know what ErrorLevel means? How then is it clearer to use ErrorLevel via the comma operator? Why are you interested in the ErrorLevel and not the return value?
Code: Select all
I_dont_care_ErrorLevel_I_dont_read_the_docs := function(args)
The other guy uses comma.
return ErrorLevel from functions
Now I'm not sure what you mean by corner case, or why it's a bad thing. v2 is more consistent - for instance, compare MsgBox ++ and MsBox ++ on v1.strobo wrote:p ++
I think that just reinforces my point. It isn't inherently clearer at all; you are just more familiar with ErrorLevel. It has no benefit to a new user. I think someone that doesn't know how the comma operator works (or is familiar with its behaviour in v1, which is different) would find your code more confusing.The guy who don't know ErrorLevel [...] is interested in the return value and doesn't use ErrorLevel via comma operator.
The other guy uses comma.
By the way, I think this thread has defeated the purpose of adding the v2 forum (to avoid putting various unrelated discussions into one big thread). Would a moderator care to split the posts up?
Re: v2-thoughts Discussion
Afaik
is expression
is not (IIRC). Then, what about
I guess it is expression;)
Code: Select all
q := 1
Code: Select all
q ++
Code: Select all
q += 1
The user could use the function letter-by-letter as in your example, if the function returns a meaningfull value. So, no difference there. And, if the user uses some fancy option to alter the semantics of the ErrorLevel (e.g. breaking some accepted rule like "return true on succes"), he doesn't necessarily need to alter the semantics of the return value. As said, it is subtle and maybe to academic to be of relevance here, but iirc the topic name was "v2-thoughts..."It isn't inherently clearer at all;
Re: v2-thoughts Discussion
They do not need to guess. They simply need to read the documentation. If they are unwilling to do that why should we assume they will pay any attention to how the function signature is defined. Error levels are enigmatic in other environments as well. Any that employ them from other languages is familiar with having to pay special attention to them. In this, AutoHotkey is especially standardized. Some commands and functionalities may be used rather carelessly. Some require more detailed attention to the documentation and an understanding that is not often found in novice of how these functionalities operate. still others function in ways that have little or nothing to do with the way AutoHotkey is implemented (COM). Like it or not Errorlevel is going to require some extra attention to detail wherever it is used. It is not intuitive and I don't think it can be. What I actually think you might be looking for is what the name errorlevel implies. a success/failure indicator for commands and or functions ( I am not sure how this would work with functions). unfortunately Errorlevels have a very long history of being used for and by programmers to indicate numerous things. in some environs they even accept input.
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Re: v2-thoughts Discussion
let me quote LexikosThey do not need to guess.
I prefer a guessable, easy to remember API, but it's only me.They can...
Then, why not unlink return value and ErrorLevel, sth one could easily extract from this quoteIf they are unwilling to do that why should we assume they will pay any attention to how the function signature is defined...
Like it or not Errorlevel is going to require some extra attention
I haven't proposed that all functions should return (!)ErrorLevel. I have stated that the binding of the return values to ErrorLevel or !ErrorLevel seems not to be consistent. This does not imply that I propose to bind all to, say, ErrorLevel. Just use the quoted "accepted rule" as counter example (in the sense of a rule, not in the sense of actual return values).And, if the user uses some fancy option to alter the semantics of the ErrorLevel (e.g. breaking some accepted rule like "return true on succes"), he doesn't necessarily need to alter the semantics of the return value.
Re: v2-thoughts Discussion
N += 1 is an expression in both versions, even if N is a command name. The same goes for any binary assignment operator. Postfix operators like ++ were inconsistent in v1.
That's a hypothetical that has no relevance to the discussion. When I referred to returning !ErrorLevel, that was to avoid having to list all of the commands. I wasn't saying these functions will always return !ErrorLevel even if ErrorLevel is changed (which it won't be).So, no difference there. And, if the user uses some fancy option to alter the semantics of the ErrorLevel
Don't take it out of context. Read the topic before posting. The thread is about the document linked in the first post, named v2-thoughts.iirc the topic name was "v2-thoughts..."
I said they can, not that they need to. tank said they don't need to.let me quote Lexikos
Re: v2-thoughts Discussion
It is consistent... Functions which just indicate success or failure (as opposed to returning some other value, like text, a process exit code, message return value, etc.) have a uniform behaviour.strobo wrote:I have stated that the binding of the return values to ErrorLevel or !ErrorLevel seems not to be consistent.
Re: v2-thoughts Discussion
I agree, although I warned two times that it might not be relevant (for this audience at least), so, I haven't keep it alive.That's a hypothetical that has no relevance to the discussion.
I haven't. I have.Don't take it out of context. Read the topic before posting.
My position was not that they need to guess, but that they _should be able to_ guess. And You wrote in this context, "They can..." Maybe my poor english let me interpret it falsely as confirmation that they (actually) are able to guess. But tank also wroteI said they can, not that they need to. tank said they don't need to.
which is in fact (in cases) opposite to "be able to guess", as, if one is able to guess, one does not need (in this cases) to read the documentation.They do not need to guess. They simply need to read the documentation.
And, to be ABSOLUTELY CLEAR, my position is NOT that they _should not_ read the documentation. And, my position is not that tea is superior to coffee. Nvm, I won't disturb your topic hygiene anymore.
Re: v2-thoughts Discussion
To be clear, you're saying that "They need to read the documentation" means that they can't guess? I don't think tank meant it that strictly. Originally (and again) you quoted "They do not need to guess", which in no way means that they can't guess.
However, they do need to read the documentation if they want to use each function correctly. If they don't, they will run into trouble eventually. You can guess, but that doesn't mean the result will always be good...
However, they do need to read the documentation if they want to use each function correctly. If they don't, they will run into trouble eventually. You can guess, but that doesn't mean the result will always be good...
Re: v2-thoughts Discussion
I agree. It's like trying to speak a language you've never learned.
You know what happens : it comes all crooked and full of errors.
You know what happens : it comes all crooked and full of errors.
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Re: v2-thoughts Discussion
How to earn here such indulgence?"They need to read the documentation" means that they can't guess? I don't think tank meant it that strictly.
edited:"They do not need to guess", which in no way means that they can't guess.
I agree, and, I have never written it (the implication: need not guess ==> can't guess) down.
This part of the discussion is not constructive, it is imho better to move on.
Re: v2-thoughts Discussion
Because, for all of my poorly worded statements. Lexikos has come to quite well understand what I do and don't mean over the course of years and thousands of posts.strobo wrote:How to earn here such indulgence?
agreestrobo wrote:[..]discussion is not constructive, it is imho better to move on.
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Return to “AutoHotkey Development”
Who is online
Users browsing this forum: No registered users and 22 guests