Autocomplete is pedantic?

I’ve been thinking about this for a little while now, before I put in a feature request I thought I’d seek some enlightenment. I’m trying to figure out why the decision has been made to limit autocomplete in the way it does. Is it a feature or a limitation of how things are implemented in the IDE?

Bear with me here as I write out my thought process, let me know if you agree/disagree?

Let say you want to read from a socket. So you:

Dim oSocket As New TCPSocket

I’m guessing that Read will be in there somewhere so:

oS<TAB>.rea<TAB>

Nothing, hmm, maybe its called somethings else.

Right click TCPSocket and Open Language Reference.

Methods > Read, hmm its there.

Oh right, it returns a string.

Dim tmp As String tmp = oS<TAB>.rea<TAB>

Can you see where I’m going with this?

What is the use of an autocomplete system that puts the onus on the coder to remember that a call must have a return value before even showing it on the autocomplete list? Why not show everything that is available for oS and let the coder worry about taking care of the return value after the fact? If they don’t it will be caught in compilation with the “You must use the value returned by this function” error message.

The ironic part is that it doesn’t even matter if I changed tmp to an Integer in the example above, it would still let the autocomplete work so why stop it in the first place if I’m going to end up with a compilation error anyway?

The time that this gets really painful is when you can’t look things up with the Language Reference, like with custom Methods etc. I can quite often remember the first few characters of the call enough to narrow the autocomplete list, but when it doesn’t show because it has a return value I start to question if I have the right method call, when that happens I have to go digging and get a tiny bit frustrated when I was right on the money with my guess, I just forgot to put “a=” in front of the guess, even though I don’t need to declare a! It just seems like being pedantic for the sake of being non-intuitive and awkward, or is it just me?

Thoughts/comments?

I have run into the same thing but I think it helps me write code better. I may not remember the exact name of a method, but most of the time I know if I want/need one that returns a value…

In general I think context sensitive autocomplete is a good thing and helps keep the autocomplete menu to a reasonable size.

  • Karen

What would you have autocomplete do instead? It can’t just complete because then you will not have the correct return value. Create the return var for you? No, no. There has to be some responsibility of the coder to remember and employ methods and functions correctly.

I would have it show me the available options, so I could select the one I was after and continue coding the remainder of the line. When I get to the end move the mouse over the line (don’t get me started on that “feature”) and press HOME and put in "Dim tmp As String = " at the start. As opposed to what happens now, my flow is stopped, I have to jump off to another program (LR) to look up the info or jump to another part of the program to find the name of the call, then come back to where I was and start over again all of which is a waste of time.

Julian, you can do:

= oS<TAB>.rea<TAB>

No need to dim a variable or use one.

Julian, I understand what you are after and you are always free to file a feature request for same. My personal response would be that, while I code only in Xojo at the present, I have dabbled enough in C++, Java, Perl, PHP, Obj-C/Swift to know that Xojo does far more “hand-holding” of the programmer than most any other language. With the current challenges (64-bit, Android) and possible future challenges (Marzipan) for the Xojo engineers, I would not want them spending any time on more hand-holding of the coders.

Nice input so far, thanks guys but please don’t turn this thread into a “don’t waste time on xyz” thread, we know how that went with windows flicker :slight_smile:

Am I really looking at a historic “it’s just the way it does it” problem here and no one has ever thought that it could be done better?

I’d be interested to see another another IDE that makes you remember the return type it returns before providing you with an autocomplete list? Anyone?

[quote]we know how that went with windows flicker :)[/quote] You’re really comparing apples and oranges. Windows flicker drastically affects the quality of our apps. This “problem” doesn’t in any way.

[quote]it could be done better[/quote] Of course it could be done better. What can’t? But is it worth the time an effort of the engineers?

It does not force you to remember the return type, but only that it does return something.

Well that depends if its a 30 minute job or a 30 hour job :slight_smile:

We’re not here to ask how or how long, we’re here to use and ask for new shiny things, I thought I was doing something wrong the way I was going about things /shrug

I guess I was fishing for an answer from an old school Xojo IDE user as this topic might have come up in the past (I couldn’t find much about it specifically on search). Did the previous IDE do the same, was autocomplete in that?

True true, typo :slight_smile:

IMO, if you don’t know what the function you’re invoking does, you should probably be reading the docs or figure it out first in all honesty. If a class has a “Read” Method that is supposed to read something, where is it going to put the information it reads, if you don’t supply a variable for the information to go? If you don’t expect to put the information anywhere, then the developer is simply “Calling” the method which is why:

Call TcpSocket.ReadAll()

works correctly, and we didn’t put the returned data anywhere. :slight_smile: Some coding is common sense more than ‘lack of reading the documentation.’ While programming, you should be reading through your code, like a book. If a sentence doesn’t make sense, it should stand out; Just as If 1 + 3 = 9 doesn’t make sense, the developer should be able to spot the error, as long as they’re actually putting thought into the code and not programming autonomously (me about 2am with no coffee :-p). Autocomplete does exactly what it’s supposed to. If you’re able to enter a certain keyword or dot notation, then it will be present (autocomplete), otherwise, it will not. Xojo simply tells you… “hey, did you forget this is not usable here?” and will not display the desired keyword/notation until the conditions that allow it to be present, exist.

On my first day of studying Linux in gradeschool, my instructor said… “Now, on the command line I want you to enter ‘rm -R *’ and press enter.” About 2/3 of the class did so. I, on the other hand, read the homework as instructed the previous night to have a clear understanding, and remained still, calmly giggling to myself as I knew what was happening around me. Needless to say, the students that didn’t do their homework got to stay after school for 3 hours and learn how to re-install the Linux OS :slight_smile: If you didn’t do your homework in his class he always knew because he’d throw something at us that was seemingly benign that was truly malevolent and pure evil as aforementioned. :slight_smile: Always follow the docs. I like to think I know a good chunk of the Xojo docs religiously… but in the same token, I always leave them up to ‘double check.’ The Docs are your best friend.

http://developer.xojo.com/byref

:slight_smile:

:slight_smile:

lol so then why not just paste something like the following into a module? It overloads the Read method to accept byref, and now you don’t need to set the variable using an equal sign, and the Autocomplete will function as you desire :slight_smile: In all honesty though, byref can be eliminated or left intact, and the code will work the same :slight_smile:

Public Sub Read(extends sock as TCPSocket, Byref Output as String)
  Output = sock.ReadAll()
End Sub

Dim myVar as String  (somewhere it exists)

myTCP.Read(myVar)

msgbox "We read the following: " + myVar

It was not always like that. Far away from now I mean… long time ago it was not needed.

Hmm, not quite the point I’m trying to understand/make, but thanks for the information.

[quote=365858:@Alberto De Poo]= oS.rea
No need to dim a variable or use one.[/quote]

Good little timesaver. Thx.

It’s been this way for at least the last 12 years. And I personally like it the way it is. I found it rather clever when I first started that autocomplete was context-aware. I think it saves me time by not having to look through a bunch of methods to find the function I’m after. Or vice versa.