majkinetor wrote:
- You will have to abandon your attitude about global variables.
Wrong. My attitude is to avoid using them
when they are not necessary. In the case of structs, I am certain it will be possible
without necessarily using global variables. After all, using Insert/ExtractInteger you can support structs without global variables.
The only issue I can think of is when a struct contains a string (that needs a seperate variable or block of memory.) There would still be ways other than global variables, but perhaps not ideal ways.
Quote:
I suggested number of times to Chris that there should be a way for explicitely free variables not used any more.
In some instances (such as with structs!), there is--use external memory management functions. The only problem with that is you
must explicitly release the memory, and losing your pointer to the memory would make that impossible. Of course, then it's your fault for losing the pointer.

The lack of built-in language support for freeing variables is the very reason I avoid using globals as temporary variables.
As an example, what if you needed to create 100 structures (POINT, for example), temporarily inside a function? You'd then have 400 global variables- 100 POINTs, 100 POINT?Xs, 100 POINT?Ys, and 100 redundant definitions of the POINT struct.
Probably a bad example, though, as you could manually create 1 (800 byte) variable, then use Insert/ExtractInteger to set/get each POINT. That would save the overhead of (at least) 99 AHK variables...
Quote:
This is just a 10-liner language and it isn't designed for anything serious.
For any "serious" programming, I'd use C#. However, there are things I will want to do in AutoHotkey that require the use of structs.
Quote:
Well, if everybody thinks that way, then we will get bunch of "I did it just for me and if it suits you use it" things.
I was referring to ahkstructlib. (To state the obvious,) I did not write that. I never said I would write my own API just for me. Heck, if I was doing it only for myself you never would have known I was planning on doing it.
Quote:
Do I have to tell you what is Open Source programming ?
Not everyone believes in the Open Source philosophy. I
strongly believe, however, it is wrong to force your ideals on another person... (hint, stfu)
Quote:
Do I have to tell you that scritps you make should constantly evolve based not only on your preferences, habits and ideas?
So tell me, guru, what
should they evolve based on?
Quote:
Do I really have to tell you that programmers should not have to be so selfish ?
My view on humanity is that no-one is motivated to do anything unless it benefits them in some way. The majority of programmers are "selfish." They write code to get paid, not to help other people.
Quote:
The fundamental mistake of 99% of programmers is that they THINK they know how will thing be used.
You still haven't given me a single example of where it would be useful. Anyway, if I made an API that doesn't allow dynamic structure sizes, changing the structure at run-time
would be incorrect use of the API. The main use of structs in AHK is with calls to external .dlls, mainly the Win32 ones. Structs in Win32 NEVER change definition at run-time.
One thing I do recognize- it may be useful to change the
usage of a field at run-time. For example, instead of assigning a string to a field, you may want to assign a string pointer (e.g. to point to memory from another process.) However, this doesn't mean the structure needs to change- you could simply use a different accessor function.
I'm curious... how much experience do you have with other programming languages?
Quote:
You can't tell me how to programm you know?
I can tell you, doesn't mean you'll listen.

Quote:
Maybe I want to create plugins that can define their own structures out of basic building blocks, that plugin-host can use...
Then you'd use a different API. Plain and simple. That is certainly not a common usage, and not what I would have in mind.
Quote:
You don't know and you shouldn't think about how your module will be used.
You should
always think about how your module will be used. If you don't, you're certain to have problems. Perhaps what you should be saying is "you shouldn't
unnecessarily restrict what your module may be used for."
Quote:
You should create it to be as good as possible which means lot of things - sophistication, performance, easy of use, zero-configuration etc.
I disagree. Ideally, my wrapper-generator should generate SIMPLE (short, efficient, readable) code.
Quote:
So, mathematicaly speaking I was not wrong.
Code:
majkinetorIsWrong()
{
if (0 != 1 && 0 != 51)
return true
}
Surely you're not so bad with math that you don't know zero does not equal one?

You could say
few people use it. Even so, exactly how do you know how many people use it? There's no way you could know.
Also, the fact (or theory) that
few people use "remote process memory" is not reason enough to not support it. I'd most likely only support it as an auxiliary function, though, for code simplicity/efficiency reasons.
P.S. I apologise for all the quotes. I like people to know wtf I'm talking about...