Uffffffffffff, what in gods name happened here...
There is an equivalence between operators and methods.
Nope, there isn't. I suppose the next statement is, there is an equivalence between operators and functions, there is an equivalence between operators and labels. Nope, there is not.
That nope goes from the autohotkey level, down into c++, slapping c then heading down into assembly, pooling into binary then as electrons leaving the cpu.
It shouldn't be possible to confuse the idea of operators, with the idea of methods/functions or with the idea of an object with its own/inherited members.
2.+3
So is that a method called +3, or a method called 3 after +3 is evaluated, or is it a method called + that is called with no parenthesis and all the arguments are defined one after the other? 2.+3"hey""another one", or is a combo operator called .+ and behaves like += with a variable called 2? or is it there a default method to which +3 is passed to?
Oh ok, it's an integer, exposed as an object, and the . is parsed as do onto self the + of the value of the this other fake integer emulation called 3 right next to it. Makes perfect sense.
So the . is not accessor? it's the do self operator? Or is 2 a reference? 2.+3 add three to self, 2.=3 or 2.3 assign three to self. Checks out.
Do you know what the dot does? like the concept of the dot? What its role is in obj.method() or obj.field? Not in obj . method(), but obj.method().
Do you know what obj is? what obj could possibly contain? the concept of an reference?
Do you know the difference between the concepts of an integer, float, string, object?
You are not adding a method to an object when you do obj.method, you are not really operating method onto object, or object onto method.
Do you know the difference between a . and ( ? Do you know what () is? why there is a ( and a )?
Do you think the ( is an operator? Do you think ( has the same purpose of a . in an expression or a dereference? That the underlying concept they are doing is interchangeable? That the action they are performing is the same?
Do you think obj.method() is the same as obj(method() ?
Do you think obj.method() is in reality obj.method(). ? Hence the thought process obj(method()) ?
Do you think in obj.params, that params is a parameter of the object?
The dot is convention, but let's do
obj%method<param>
Or even better
obj(method.param.
Roll the same questions.
Boils down to something as simple as is 2+3 the same as 2*3? can you represent 2*3+1 without using the symbols or using the same symbols in every combo and complex mathematical expression?
Do you think this sentence. "Hello, my name is John." Is the same as "Hello. my name is John," ?
Do you think getting a book from the shelf and going through its table of contents in whatever manner you decide, is the same as going to the page, reading it, then coming back to the table of contents? Are they the same action?
obj(push("dog", "cat")) ; obj is not a function and does not take arguments.
Orly, why wouldn't it be a function? because it's an object?
class xyz {
// bla bla
abc() {
return "bleble"
}
}
xyz(param) {
return "blabla"
}
abc() {
return "bloblo"
}
xyz(abc())
??????????????????????????????????
which should be command syntax for object methods.
No, no, no it shouldn't. Never should. The concept of a dot is not the same as a space, or a parenthesis. The concept of an object is not the same to that of a function.
Code: Select all
object push "dog", "cat" ;// defined as both, I want to concatenate the variable push with "dog", what do you do? push is a method, the obvious conclusion; push is a variable, the obvious conclusion.
Scrolling through one included file, and its definition is dumped into some other include, what is this?
garbage(callmeOrNot(syntax(maybe())), arg2(arg3)) ? define it, without looking at the file it is defined in, which is not going to be 20 lines. Tell me the functions, tell me the objects. Which one is the method.
Function syntax argument once and for all by allowing both commands and functions to have the same expressiveness
Do you think obj.method is the problem with function syntax? Since when? it has never been part of the argument. Do you think the . represents a function call?
Do you think the idea when you do obj.method() is to get method as a value from object and then the value returned from method?
A space, a comma and a parenthesis enter into a bar, the dot gets shot in the head. The end.
It would only take like 5 minutes to enforce command(args) on users as opposed to do whatever 2.+3 is.
The function vs command issue is calling functions and commands. Nothing to do with the dot or objects, not sure why they are now being brought here.
The reason you can do str.contains() in other languages is because at the scripted layer, str is exposed as an object and contains is a method of of that object, call it a "characteristic" that it has. contains in these cases in not an operator. Autohotkey does not expose regular variables or strings for that matter as objects. There are plenty of examples where you can emulate this using the base object, you will have the added overhead however. Define your own function and do str.contains()
Variables in python are exposed as objects (and are), Variables in javascript are exposed as objects (and are). Variables in autohotkey are not exposed as objects (and are). Only variables containing object references are exposed as objects. Not even sure how much time it would take to rework variables to dereference to objects, and if they would retain the same performance in the current implementation of objects, which would also lead to all string functions to be methods for string type.
such that operators are in some sense global methods