Suggestion: In the doc, spell UNINITIALIZED the American way. UNINITIALISED is a British spelling, and FAR FAR more uncommon.
This may be going to an extreme, but that is my habit. I was looking at some code (an beautiful example by nnnik about sorting and dupes) which included:
str := ""
for each, value in arr2
str .= value
Msgbox % str " " strlen(str)
and was wondering, Is the first line REALLY needed? So I went to help to find out about uninitialized variables. I found nothing!!! I spent 15 minutes trying to figure them out. Wasted!
@nnnik : don't get me wrong. I'm all for: Str = ""
Google search results:
UNINITIALISED - 14,000,000 hits
UNINITIALIZED - 89,300,000 hits
Okay, some are going to say this is silly. Here is the rationale.
I went to the help and index and looked for VARIABLES. The INDEX entry VARIABLES takes one to "Variables and Expressions". I read practically (well, scanned) all of it only to find nothing there about unitialized variables. In that article is a pointer (yes, at the very top) to another topic, this one named simply "Variables". The index is a problem in that it does not a "Variables and Expressions" entry. Secondly, "Variables and Expressions" talks about storing values in a variable. Well, isn't that what INITIALIZATION or it's lack thereof does? So, why not mention UNITIALIZED there as well?
uninitialized
Re: uninitialized
Hi Joe. First, great suggestion to make a sub-forum for documentation suggestions, it's funny how the simplest and most obvious solutions can be so elusive. Second, I agree with the spelling suggestion, although it is pretty minor. I've tried to use American spelling (in my prs) as I've thought it to be the standard in the docs, but I'm not a native English speaker, so I don't always know. Another example is colour vs color.
Cheers.
Cheers.
Re: uninitialized
i dont normally type out the entire thing when looking for something, so this likely wouldnt have affected me, but i agree, Z is more common. i too think it should be the default.
Re: uninitialized
Generally that just shows that we might need a better search function. Even if we change to a different spelling people that expect and search for the old one might get confused.
@off topic:
I don't really feel the need to initialize every variable.
In v1 the behavior is well defined for most cases and less code means a lower chance of you making errors
@off topic:
I don't really feel the need to initialize every variable.
In v1 the behavior is well defined for most cases and less code means a lower chance of you making errors
Recommends AHK Studio
Re: uninitialized
As a matter of interest, here's an early Google search for Americanisation, and one for Americanization.
The English one has the earliest reference viz "re-Americanisation" found in the Edinburgh review (1830), the earliest for American "z" version is for 1835. Best not to take that as too reliable, as the OCR scans often misfire. The Wikipedia page has both spellings.
The spelling differences page actually recommends "ize" or "ise", based on historical usage amongst other things, so yep- "ize" looks the go, unfortunately for many of us. Note the exceptions do not have an "isation" or "ization" ending.
The English one has the earliest reference viz "re-Americanisation" found in the Edinburgh review (1830), the earliest for American "z" version is for 1835. Best not to take that as too reliable, as the OCR scans often misfire. The Wikipedia page has both spellings.
The spelling differences page actually recommends "ize" or "ise", based on historical usage amongst other things, so yep- "ize" looks the go, unfortunately for many of us. Note the exceptions do not have an "isation" or "ization" ending.
itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Re: uninitialized
Thanks for all the positive feedback. However, everyone is missing two points, which, because of my tendency to be verbose, were probably glossed over. (I do, however, try to be extremely precise, which also requires more words!)
The points were in this portion of my post:
a. Variables (a subsection of "Concepts and Conventions")
b. Variables and Expressions
But, only one of these "variables" is in the INDEX. And, these are a mess.
The INDEXed entry, entitled "Variables" takes us to the topic "Variables and Expressions". Therein is contained a subsection entitled "Variables". However, therein is contained a link to another "Variables" section, this one a subsection of "Concepts and Conventions". And it gets worse.
The "Concepts and Conventions/Variables" section includes:
So, we have the same FACT stated two different ways in the same topic. Not nice!
(Aside: The word "default" in "an empty string being the default value" is TOTALLY unnecessary and MISLEADING. Is there any other value for an uninitialized variable? It makes one think so.)
2. Further examination of "Concepts and Conventions/Variables" finds this, the 2nd paragraph:
a. it says variables are created by simply using them. I consider than wrong. They exist--yes, in a theoretical way--as UNINITIALIZED variables.
b. it says "Each newly created variable contains an empty string until ...". "newly created" was defined, in the first sentence, as "by using them". But, you don't have to USE a variable for it to have an (uninitialized) value. That is, every conceivable variable EXISTS even before it is used.
(Sorry for this being so metaphysical.)
So, to sum it all up, all I am really saying is that these parts of the doc need some work!
Thanks. (especially if you are still reading!)
Afterthought: now that I preview what I have written, I am beginning to think the major problem is having a topic "Variables and Expressions". This should be two separate topics. VARIABLES are things that store/define data; Expressions are operations done upon that data (in a sense). VARIABLES should be on the same conceptual level as OBJECTS.
The points were in this portion of my post:
1. There are two distinct help sections.I went to the help and index and looked for VARIABLES. The INDEX entry VARIABLES takes one to "Variables and Expressions". I read practically (well, scanned) all of it only to find nothing there about unitialized variables. In that article is a pointer (yes, at the very top) to another topic, this one named simply "Variables". The index is a problem in that it does not a "Variables and Expressions" entry. Secondly, "Variables and Expressions" talks about storing values in a variable. Well, isn't that what INITIALIZATION or it's lack thereof does? So, why not mention UNITIALIZED there as well
a. Variables (a subsection of "Concepts and Conventions")
b. Variables and Expressions
But, only one of these "variables" is in the INDEX. And, these are a mess.
The INDEXed entry, entitled "Variables" takes us to the topic "Variables and Expressions". Therein is contained a subsection entitled "Variables". However, therein is contained a link to another "Variables" section, this one a subsection of "Concepts and Conventions". And it gets worse.
The "Concepts and Conventions/Variables" section includes:
However, further down we find the sub-subsection "Concepts and Conventions/Variables/Uninitialised Variables". There we find:Each variable starts off empty/blank; in other words, each newly created variable contains an empty string until it is assigned some other value.
Although the program automatically initialises all variables (an empty string being the default value), it is good practice for a script to always initialise its variables before use
So, we have the same FACT stated two different ways in the same topic. Not nice!
(Aside: The word "default" in "an empty string being the default value" is TOTALLY unnecessary and MISLEADING. Is there any other value for an uninitialized variable? It makes one think so.)
2. Further examination of "Concepts and Conventions/Variables" finds this, the 2nd paragraph:
This--and part of it I have already discussed--is replete with problems.In AutoHotkey, variables are created simply by using them. Each variable is not permanently restricted to a single data type, but can instead hold a value of any type: string, number or object. Each variable starts off empty/blank; in other words, each newly created variable contains an empty string until it is assigned some other value
a. it says variables are created by simply using them. I consider than wrong. They exist--yes, in a theoretical way--as UNINITIALIZED variables.
b. it says "Each newly created variable contains an empty string until ...". "newly created" was defined, in the first sentence, as "by using them". But, you don't have to USE a variable for it to have an (uninitialized) value. That is, every conceivable variable EXISTS even before it is used.
(Sorry for this being so metaphysical.)
So, to sum it all up, all I am really saying is that these parts of the doc need some work!
Thanks. (especially if you are still reading!)
Afterthought: now that I preview what I have written, I am beginning to think the major problem is having a topic "Variables and Expressions". This should be two separate topics. VARIABLES are things that store/define data; Expressions are operations done upon that data (in a sense). VARIABLES should be on the same conceptual level as OBJECTS.
Re: uninitialized
I agree, notwithstanding many of the high quality descriptions in Variables & Expressions, there is too much content compared to the others. Perhaps we could even have something like separate topics for Variables, Expression, and The Use of Variables in Expressions.
@joefiesta, why not a new thread for this, along with an HTML proforma of how you want to see it?
@joefiesta, why not a new thread for this, along with an HTML proforma of how you want to see it?
itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Re: uninitialized
There's another related part in the docs:
More about locals and globals wrote:Common source of confusion: Any non-dynamic reference to a variable creates that variable the moment the script launches. ...
https://www.autohotkey.com/docs/Functions.htm#More_about_locals_and_globals
Re: uninitialized
@Imstearn - because this started out as a problem deciphering UNITIALIZED VARIABLES (yes, could be two topics but they were both discussed initially).
Return to “Suggestions on Documentation Improvements”
Who is online
Users browsing this forum: No registered users and 8 guests