[Solved]Can method be called as command?→Yes in V2 Topic is solved

Discuss the future of the AutoHotkey language
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

[Solved]Can method be called as command?→Yes in V2

14 Jun 2014, 00:19

Can method be called as command? Like function be called as command.

Code: Select all

class o{
  m(a:=0,b:=0,c:=0){
    ..
  }
}
x:=o.m equals x:=func("o.m").
Type(x) is "func", use like %x%(o,1,2,3).
Can't use x(...) nor %x% o,1,2,3—"This dynamic variable is blank", nor x o,1,2,3 (or better x 1,2,3)—"Call to nonexistent function".
  • Can't do so, because x is var (not a user function) contain dynamical var like funcObj?
  • Can method be called as command, Like o.m 1,2,3?
Last edited by RobertL on 29 Jul 2014, 02:09, edited 2 times in total.
我为人人,人人为己?
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Can method be called as command?

15 Jun 2014, 01:53

Not yet.

Dynamic calls using command syntax are not supported, nor planned to be supported.
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: Can method be called as command?

15 Jun 2014, 04:42

:geek:
Hah, got it.
Thank you~
我为人人,人人为己?
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Solved]Can method be called as command?→No  Topic is solved

28 Jul 2014, 08:01

v2.0-a049 supports calling methods with command syntax.

There's also another thread on this topic.
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Solved]Can method be called as command?→No

29 Jul 2014, 02:09

Wow! I love it!
Thank you for reminding me!
我为人人,人人为己?
just me
Posts: 9575
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Solved]Can method be called as command?→Yes in V2

29 Jul 2014, 03:06

I don't! IMO, it's just another feature to discourage "new to ahk" programmers.
tank wrote:There is a fine line between "noob friendly" and "new to ahk friendly". I tend to side with "noob friendly".
Source
The command syntax is the "noob friendly" side of AHK, but they shouldn't try to use objects as long as they are "noobs".

What do you think, how my workmates reacted when I was asked "How did you do it?" and answered "I did it with AutoHotkey."?
"A u t o w h a t ? ? ?"! And none of them took more than a short look at the documentation.

That's one of my reasons to side with "new to ahk friendly". Once we've got the interest of a programmer, he'll most likely stay a while longer than most of the "noobs".
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Solved]Can method be called as command?→Yes in V2

29 Jul 2014, 05:30

just me wrote:I don't! IMO, it's just another feature to discourage "new to ahk" programmers.

That's one of my reasons to side with "new to ahk friendly". Once we've got the interest of a programmer, he'll most likely stay a while longer than most of the "noobs".
I find the new way flexible and convenient, with no various interpretations.

Starting from basic syntax, follow in order and advance step by step.
Problem actually begans from involving too many new information, who can't absorb them.
It's about study method, maybe a useful simplification of document or guide with different difficult level is nice.

I had write a Chinese AHK wiki with some distinction of concept, I think it's very clear and helps to understand and use AHK.
I will try to translate some of them (English, what my pain), need checking the result first.
Last edited by RobertL on 30 Jul 2014, 21:33, edited 1 time in total.
我为人人,人人为己?
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

30 Jul 2014, 21:30

just me, you are free to "not love" whatever you want. Personally, I think your argument is illogical.

It's a natural extension of the command syntax. I see no reason that this capability would cause potential users to turn away from AutoHotkey. Did you ask your workmates why they did not consider AutoHotkey? I bet it wasn't because they saw too much in the documentation. Perhaps they weren't interested because it's "just a hotkey/macro tool". Maybe they just prefer the uniformity of AutoIt's syntax or its similarity to Basic/VB/VBScript. Maybe there was no logic involved, and it simply didn't take their interest.

It's only the introduction of expressions that actually got me interested in AutoHotkey as anything more than a tool for remapping my extra mouse buttons.

fincs thinks the command syntax will make objects more accessible to newbies. I've never been convinced that command syntax is easier than expression syntax, but I'm biased by years of experience with expression syntax across several languages.
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

31 Jul 2014, 01:54

I did not know anything about any other languages (only a little html and css) when i startet using Autohotkey 2½ years ago...

So as most other novice users at the time, I downloaded ahk 1.0 and I got by, by using what i found on the forum, and the autoscriptwriter :roll: (there's alot of command syntax in the old forum), but as I often do, I read the forum and found that most older users recommended ahk_L at the time, this did in no way put me off, and I say in no way as that was how it was, there was a clear path and it seemed the bast thing to use, so I decided to use use what the older users also used, I have used AHk 1.1+ ever since. As my work needs at the time was to automate data entry into IE it was not long before i found out that the build in COM of AHk 1.1+ was the way to go, this togetter with my increaseing appetite for automation got me started using objects, functions and the dot syntax.

But as a new user I learned from reading the forum and also the examples in the documentation, but only after finding someone using it in a forum topic. This all leads me to think that some newbies will do something like me and by that i meen look at how the "old" users do it, then copy that and maybe look at the documentation if there is any issue with the code.

Now if we the "old" users keep using/mixing both command and function syntax for every other thing, I think that it will make it hard on new peeple as there will be no clear path to take when determining what syntax to use/learn and this may lead them to deciding that it's all over their head, and turn them away... but hey i'm not sure as only time will tell.

I hope that makes sense. :)
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [Solved]Can method be called as command?→Yes in V2

31 Jul 2014, 05:45

@Blackholyman
For me, I leanded from reading the help manual only, although there is a lot of tutorial.
I think / My experience the official document is always the succinctest.
There is a learning curve in the process of studying follow manual, it's worth!
我为人人,人人为己?
just me
Posts: 9575
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [Solved]Can method be called as command?→Yes in V2

31 Jul 2014, 15:36

lexikos wrote:Maybe they just prefer the uniformity of AutoIt's syntax ...
Exactly! Do you know a programmer who doesn't prefer a clear and strict syntax? And what about: "...but we'd end up with two ways of doing the same thing."
guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: [Solved]Can method be called as command?→Yes in V2

31 Jul 2014, 15:58

just me wrote:
lexikos wrote:Maybe they just prefer the uniformity of AutoIt's syntax ...
Exactly! Do you know a programmer who doesn't prefer a clear and strict syntax? And what about: "...but we'd end up with two ways of doing the same thing."
Define 'programmer'. Some programmers prefer strict syntax. AHK gamers who write basic scripts for their games probably could care less and just want to get shit done and get back to their game. Again, who is your target?

Other real programmers may also prefer strongly typed languages as well as immutable objects. Pick the right tool for the job. Horses for different courses. Etc

Should we remove class syntax, array [] syntax, regex ~= operator, etc since these are all redundant as well? After all too many options may confuse ppl.. :roll:

I understand your gripe, but as I mentioned I think its easily handled with correct presentation on the website. I like the idea of a quick example code that poly has on the ahk.com front page, but I probably would have chosen something slightly different. Funnily enough, the script doesn't even work because of the lack of the ; comment char

lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

31 Jul 2014, 16:52

Do you know a programmer who doesn't prefer a clear and strict syntax?
Why are you even here, using AutoHotkey? I certainly don't prefer AutoIt's syntax. Chris probably doesn't given that he designed our current syntax. How many non-hotkey scripts have other users written in AutoHotkey that they could have written in a "clearer and stricter" language?
User avatar
joedf
Posts: 9000
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

01 Aug 2014, 08:18

I am definitely not looking forward having to AutoIt's syntax... That's mainly why I personally use ahk instead.
Image Image Image Image Image
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]
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

01 Aug 2014, 20:12

joedf, you're not grammatical sense making. If you meant "looking forward to having", that implies a progression toward AutoIt's syntax, which isn't happening.
just me wrote: And what about: "...but we'd end up with two ways of doing the same thing."
Btw, my implication was that the advantages of the second way were not sufficient to justify it. Taking command syntax on its merits alone I probably would have said the same, but there's more to it since AutoHotkey has always had command syntax.
User avatar
joedf
Posts: 9000
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Solved]Can method be called as command?→Yes in V2

01 Aug 2014, 23:55

yes sorry, "looking forward to having" is what i wanted to write.. sorry it's a typo, i dont know why this keeps happening.. i revise it and i keep missing these things :P Thanks for the answer tho :)
Image Image Image Image Image
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]

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: Bing [Bot] and 17 guests