How about using the point operator for function calls in C4Script? After introducing the point operator for proplist access, I often mistake them, also because C++ uses the point operator for calls, except if using pointers.
That would break all third-party content and most of all I think all the main developers are pretty used to ->. I would very much oppose such change.

- We'd have to keep -> in any case for compatibility reasons (see Maikel).
- -> always starts a function call, and . always starts a proplist access. This likely makes the parser simpler.
- You already can use the point operator for calls, by rewriting
foo->Bar(1, 2, 3)
to Call(foo.Bar, 1, 2, 3)
(or maybe you need foo->Call(foo.Bar, 1, 2, 3)
, not sure)

How do you make a difference between accessing a function definition this.foo and actually calling it? Just by the brackets: this.foo, this.foo()?

"->" is for function calls and "." is for property reading/writing
.(I am not particularly for or against that at the moment; I don't see why it's objectively better, though)

foo(bar)
For remote access in context "other":
other->foo(other.bar)
After the change:
other.foo(other.bar)
The simplification would be that to go from a local lookup to another context lookup, you have to prefix "other.". That's easier to remember than prefixing "other->" for functions and "other." for properties.
I think Guenther was asking exactly this question at the time and we (me included) voted against it though. Decades of C4Script momentum are hard to stop.
Btw, could someone explain this stuff to me:
If I do
Also, my opinion is that
If I do
foo->bar()
, and bar is a function in a proplist foo, what will be the object context of that call? Does that change if foo is not a proplist but (additionally) an object?Also, my opinion is that
foo.bar->blubb.gar()
should be something meaningful, namely calling the function blubb.gar
with the object context foo.bar
(where blubb
and foo
are just proplists having their properties gar
and bar
accessed, one being an object/proplist, the other a function). I like it because there's nothing implicit about it, but I hate it because it's awfully complex and hard to read.

> If I do foo->bar(), and bar is a function in a proplist foo, what will be the object context of that call? Does that change if foo is not a proplist but (additionally) an object?
'this' will be foo. Ordinary proplists can also be contexts iirc.
> Also, my opinion is that foo.bar->blubb.gar() should be something meaningful, namely calling the function blubb.gar with the object context foo.bar
That would be nice and would indeed be an application of having the distinct . and -> operators.
You can also just do foo.bar->Call(blubb.gar) right now of course.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill