fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: better error message: for instead of foreach

better error message: for instead of foreach 1 month 1 day ago #10746

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hello,

one of my frequent errors when using the "foreach" statement is to write "for" instead of "foreach". i.e. to write
for oItem as MyItem in oList
next
instead of
foreach oItem as MyItem in oList
next
In this case the compiler gives a similar error message:
error XS9002: Parser: unexpected input ....
Would it be possible to specify it better?
Thank you very much!
Wolfgang
P.S. I'm asking here before adding a ticket because I'm not sure if such a request is appropriate
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 21 hours ago #10748

  Karl Faller's Avatar Karl Faller Away Posts: 718
Wolfgang,
not what you asked, but are you aware of this in template.cfg in XIDE:
..
fore,FOREACH \c AS IN \rNEXT\r
forei,FOREACH IMPLIED \c IN \rNEXT\r
...

I know, i use the shortcuts not enough, as i code too little to memorize them, but in this case it might be helpful.

BTW, @Chris: i think i asked for this years ago ;), but the icing on the cake for this would be:
fore <Tab>
myItem <Tab>, Cursor jumps behind the "AS "
myType <Tab>, Cursor jumps behind the "IN "
myCollection <Tab>, Cursor jumps to next line

I just think you and you baby could do this ;-)
Regards
Karl

Please Log in or Create an account to join the conversation.

Last edit: by Karl Faller.

better error message: for instead of foreach 1 month 21 hours ago #10749

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Karl,

yes, I'm aware of it. My main problem is that I'm not able to remember all these templates - I'm using only very few of them.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 20 hours ago #10750

  Karl Faller's Avatar Karl Faller Away Posts: 718

wriedmann wrote: Hi Karl,

yes, I'm aware of it. My main problem is that I'm not able to remember all these templates

B)
So i'm not alone...
But, as i wrote, the "multi tab" would enhance the usefullness a lot further...
Regards
Karl

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 20 hours ago #10751

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Karl,

maybe I will add a context menu entry to select a template to insert - that could help.

Wolfgang
P.S. did you knew I'm driving a "poor mans Tesla" now?
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 20 hours ago #10752

  Chris Pyrgas's Avatar Chris Pyrgas Offline Posts: 1410
Wolfgang - Yeah, agreed, there are several places where parser errors could become more straightforward. As time passes, more an dmore of them will be improved, it's just not of highest priority. Will log this particular one.

Karl - Every single time I use the FOREACH template, this is exactly what I am also thinking, so it is not that I have forgotten about it :). It's just a lot of work to implement it and it will be useful in only 2-3 templates, but will finally do it in one rainy day!
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 20 hours ago #10753

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Chris,

thank you very much!
It is of course a lot of work to prodice useful error messages, but it will be very helpful for people starting with X#, I think.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 19 hours ago #10754

  Karl Faller's Avatar Karl Faller Away Posts: 718

wriedmann wrote: P.S. did you knew I'm driving a "poor mans Tesla" now?

A "3"? Congratulations! Meanwhile i'm at 62,5k km in < 18 months, still grinning everytime i see my car ;-)
Regards
Karl

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 19 hours ago #10755

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Karl,

no, a Renault Zoe. The 3 is still off limits for me, but maybe in a few years <g>.
10.000 km in about 4 months... and very happy with it.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Last edit: by Wolfgang Riedmann.

better error message: for instead of foreach 1 month 19 hours ago #10757

  Chris Pyrgas's Avatar Chris Pyrgas Offline Posts: 1410
Hi Wolfgang,

The problem is not writing messages, this is the very easy part. The big task is not letting the parser handle those situations in a general way, but provide specialized error identifying and reporting for every single different case.

Btw, congrats for your Zoe! (which means "life" in Greek)
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 1 month 6 hours ago #10761

  Wolfgang Riedmann's Avatar Topic Author Wolfgang Riedmann Away Posts: 1799
Hi Chris,

I know that the providing of special messages is a bigger task, but IMHO it is very important because clear error messages are a big help during the development - and can be a real time saver.

Wolfgang
BTW: I like electric driving very much, specially in the mountains
Wolfgang Riedmann
Meran, South Tyrol, Italy

www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 4 weeks 1 day ago #10762

  Chris Pyrgas's Avatar Chris Pyrgas Offline Posts: 1410
Hi Wolfgang,

I agree, very often generic parser errors make it very difficult to find what's the problem exactly. Problem is it's 100s of cases where it needs to be adjusted...
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 2 weeks 5 days ago #10943

  Dick's Avatar Dick Offline Posts: 557

Chris wrote: Wolfgang - It's just a lot of work to implement it and it will be useful in only 2-3 templates, but will finally do it in one rainy day!


Note that there is no such thing as a "rainy day" in Greece :lol:

Dick

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 2 weeks 5 days ago #10954

  Robert van der Hulst's Avatar Robert van der Hulst Away Posts: 1244
Dick,

I thought that too, but when I visited Chris In Lamia in October 2018 it was raining 'cats and dogs'....

Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 2 weeks 4 days ago #10956

  Johan Nel's Avatar Johan Nel Away Posts: 575

robert wrote: Dick,
I thought that too, but when I visited Chris In Lamia in October 2018 it was raining 'cats and dogs'....

Raining cats and dogs here at the moment... Parks board are on standby to open up lagoons in the area due to possible flood risk seeing we also on spring tide...
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

better error message: for instead of foreach 2 weeks 4 days ago #10957

  Chris Pyrgas's Avatar Chris Pyrgas Offline Posts: 1410
Yeap, we didn't use to have much rain, in fact had issues with available water 20 years ago. But now we are getting closer to a tropical climate, have 5-6 months of a lot of heat (it's end of September and we're still having temps over 30C), followed by 3 months that rains almost every single day where I live. Then, in the Winter we are now getting snow every year, which was also a rarity in the past.

No, no, there's no climate change, it's a conspiracy! :)
(sarcasm...)
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • Page:
  • 1