Dot or colon + Intellisense (not) helping

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Dot or colon + Intellisense (not) helping

Post by ic2 »

After compiling my program with X# 2.16 I got a few dozen errors urging me to change dots to colons and also the other way around. I've done that all and the compiler seems happy with it and I know it has to do with instance members of the class requiring a colon and static members requiring a dot but in both cases it is not something I defined so I have no idea which I have to choose. I also know that I can set "Allow the DOT for instance members" in Language settings but I just wondered if there's a way of knowing which to choose before the compiler does that for me.

What won't work is Intellisense. I have this code (first 3 lines, where I had to change the : to a .):

Code: Select all

	aRow := {;
	iConnectEmail.Properties.Resources.blank, ;
	iConnectEmail.Properties.Resources.blank, ;
Not sure if it worked in 2.14 but again Intellisense doesn't do the job. It doesn't show me any tooltip info in iConnectEmail or Properties or Resources except that aRow is an array and it doesn't suggest anything when I remove a few letters, type it again and press the dot. That is what I would need to at least start to understand whether to choose a colon or a dot.

Dick
User avatar
Chris
Posts: 4910
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Dot or colon + Intellisense (not) helping

Post by Chris »

Hi Dick,

The rule is simple:
- In all cases when you access an instance member, then you need to use the colon (just like in VO). Instance members are when you use a local, or an iVar etc to access something, like oMyLocal:SomeMethod(), oDataWin:Owner:Caption etc
- In all cases when you access a static member of a class, then you need to use the dot. We did not have static members in VO at all, while in .Net it's generally this: ClassName.SomeStaticMember, like for example Application.EnableVisualStyles(), where Application is a class/type, while EnableVisualStyles() is a static method of that type.

Also when you access (with a dot) a static member of a class, then this gives you an instance of some other object, which you need to then access with a colon. For example in this code:

Code: Select all

? Application.ExecutablePath:Length
We are using the static member "ExecutablePath" of the type "Application", so we need to use the dot. This returns a string (instance of the String type), so we then need to use the colon (as in VO), to access it's property named "Length" to get the size of the string.

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Dot or colon + Intellisense (not) helping

Post by ic2 »

Hello Chris,

Thanks for the explanation. I think I can summarize it as follows: always a colon except when accessing some specific .Net class.
But what about the Intellisense? Why doesn't any of the 2 lines below show tooltips or suggestions - except to the aRow array of line 1?

Dick
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Dot or colon + Intellisense (not) helping

Post by leon-ts »

Dick,
ic2 post=26516 userid=455 wrote:But what about the Intellisense?
This is probably a bug related to string splitting.
Github: https://github.com/X-Sharp/XSharpPublic/issues/1260
Betatest: https://www.xsharp.eu/forum/betatesters ... ller#26246
Best regards,
Leonid
User avatar
Chris
Posts: 4910
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Dot or colon + Intellisense (not) helping

Post by Chris »

Hi Dick,

No I did not say that it has to do with some specific .Net classes. But I also confirm the intellisense bug you reported, looks like it has to do with continuing a line in the next line with the semicolon. Very possibly Leon is right and it's related to the other bug he has already reported, I will ask Robert if it's indeed the same root cause for both.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Dot or colon + Intellisense (not) helping

Post by robert »

Guys,
There is a small issue in the current build, where looking up type info etc. for a line that is a continuation of a previoys line does not work.
I have checked in a fix today, and that will be included in the next build.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Dot or colon + Intellisense (not) helping

Post by ic2 »

Thanks everyone for the confirmation of the bug and the quick upcoming solution from Robert.
You can leave it to me to find Intellisense bugs;)

Dick
Post Reply