VAR vs. explicit Type references in Foreach command....

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Anonymous

VAR vs. explicit Type references in Foreach command....

Post by Anonymous »

Notice in Visual Studio, if I have a Foreach command I can get intellisense for objects inside the block if I explicitly reference the Type of the item I am iterating over (Foreach Customer as Customer ...):
2019-03-12_11-22-08.png
2019-03-12_11-22-08.png (66.45 KiB) Viewed 581 times
However, if I use the "lazy" VAR method, it will not give intellisense on the Customer object inside the Foreach loop (Foreach VAR Customer ...):
2019-03-12_11-25-29.png
2019-03-12_11-25-29.png (22.28 KiB) Viewed 581 times
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

VAR vs. explicit Type references in Foreach command....

Post by lumberjack »

mattslay wrote:Notice in Visual Studio, if I have a Foreach command I can get intellisense for objects inside the block if I explicitly reference the Type of the item I am iterating over (Foreach Customer as Customer ...):
However, if I use the "lazy" VAR method, it will not give intellisense on the Customer object inside the Foreach loop (Foreach VAR Customer ...):
Have you tested if in c# it actually does work during lazy var declaration?
If yes, then it probably needs to get fixed.
If no, think you guess, if c# don't it is on the "nice" to-do list.
I do think it would be nifty if not in c# though but will not demand it then.
Regards,
______________________
Johan Nel
Boshof, South Africa
User avatar
Fabrice
Posts: 459
Joined: Thu Oct 08, 2015 7:47 am
Location: France

VAR vs. explicit Type references in Foreach command....

Post by Fabrice »

Hi Matt,
that is where you discover that X# and it's Visual Studio integration is still a work-in-progress :
I can say that easily, because that's part of my task ;)

I've started to add some support to VAR declarations, ie:
LOCAL obj AS TestClass
VAR guess:= obj:ToString()

Then if you type, guess:
you will have the members of String type in the list.

But you are right, FOREACH support is still to be done.

Fab.
XSharp Development Team
fabrice(at)xsharp.eu
FoxProMatt

VAR vs. explicit Type references in Foreach command....

Post by FoxProMatt »

lumberjack wrote: Have you tested if in c# it actually does work during lazy var declaration?
Johan - Yes, no compile-time errors, and indeed it runs just fine at execution time when I use the VAR method.
FoxProMatt

VAR vs. explicit Type references in Foreach command....

Post by FoxProMatt »

Fabrice - here is another issue...

Notice that even when I use explicit Type reference, if I then attempt to use the "i" prefix for interpolation inside a string using the {Object:Property} interpolation syntax, it does not give intellisense:
2019-03-12_12-05-01.png
2019-03-12_12-05-01.png (40.19 KiB) Viewed 581 times
User avatar
Fabrice
Posts: 459
Joined: Thu Oct 08, 2015 7:47 am
Location: France

VAR vs. explicit Type references in Foreach command....

Post by Fabrice »

Ok,...in my ToDo list...
As you can notice, nothing in VS Editor (Intellisense, QuickInfo, ...) is automatic; we have to implement all tools by ourselves, so some features are still missing, but we are making progress ;)
XSharp Development Team
fabrice(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

VAR vs. explicit Type references in Foreach command....

Post by robert »

Matt,

To add to what Fabrice said: adding a new feature to the language and the compiler is sometimes easier than adding support for our language to VS.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

VAR vs. explicit Type references in Foreach command....

Post by lumberjack »

Hi Matt,
mattslay wrote:Fabrice - here is another issue...
Notice that even when I use explicit Type reference, if I then attempt to use the "i" prefix for interpolation inside a string using the {Object:Property} interpolation syntax, it does not give intellisense:
I agree that there are things not working, lots of these were already discussed many times, we as a user base currently accept and live with it for the moment. We know the pressure is on the DevTeam to deliver. We understand as a VO/Vulcan community where we came from. We were left in a situation similar to what you guys had with VFP 9.0. Vulcan gave hope to VO users, it did not deliver as promised/expected. X# is already a full feature rich language as is. To go that step further to put language packs in is remarkable. Not like MS announced, if you want a migration path, start learning VB.NET/c#. I think if X# was announced that is it, take it or leave it as is, in Core format, it is already a 100% better alternative than migrating to VB.NET/c#, it is not a total rewrite from scratch. It will take years for the current stable release to get so far behind c# that it is not usable anymore.

It took courage to do what Robert took onto himself, no big corporate money backing him, for the love of the XBase language. He could have stopped there, VO/Vulcan community have a future. No he did not stop there, he made a commitment to unite the various XBase languages under 1 umbrella giving all of them the opportunity to step into .NET with a syntax close to what they used to. We need to give him support and a little bit of mercy for that, I believe we need to focus on the positives, e.g.
  • How well does the X# compiler compares to c# feature wise
  • How close are we already converting code from the VFP compiler syntax to X# syntax, etc.
  • Is X# positioned correctly between the XBase world and .NET, etc.
  • What features in X# is not supported in VFP, VO, Vulcan, Harbour, XBase++, etc.
  • The power of the pre-processor, the XBase language is still evolving!
I think the available far outweigh the not supported yet. It is not, no we not going to support it, there are just more important stuff to first focus on at the moment.

Trust me, Robert made VO2.5-2.8 what it was, otherwise VO would have died 15+ years ago. X# compared to VO/Vulcan is already miles ahead and I would say even ahead of c# in some cases. Yeah there are still users who bash VS and XIDE compared to the IDE in VO. Fact of the matter is, if I have Notepad I can produce code that the compiler can understand. I remember in my Clipper days, I used the Borland Turbo Pascal editor to do all my Clipper code in. No press of the button to compile/run. I was clever and could from exiting the TP IDE have my compiler going in a second, I just had to type "c" <Enter> lots of SET this and that in bat files, I was efficient. Done compiling hit "e" <enter> I am back in the editor where my cursor last was etc. Took split seconds. And no I don't want to use Notepad, XIDE and VS are miles ahead as editors/designers even with not implemented yet features.

Ok think you get my drift, not to chase you away, I just believe we need to see things in perspective. IDE is important, but I rather work with a crappy IDE than have a crappy compiler.
Just my ZAR 2c = US$0.02/14.667

We will speak soon again!
______________________
Johan Nel
Boshof, South Africa
Post Reply