Suggestions to make it easier to move between languages

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
blackcattech
Posts: 113
Joined: Mon Jan 11, 2010 10:39 pm
Location: Chesterfield

Suggestions to make it easier to move between languages

Post by blackcattech » Tue Aug 06, 2013 8:08 am

I write code in both Swordfish BASIC and a variety of C compilers for the PIC. I find I'm always having problems where Swordfish isn't working but the error isn't obvious. You can tell there is an error as the code explorer window stops showing all the subs, but it can take ages to spot the error.

The problem is always my error - I have used C terminology rather that what Swordfish uses.

The most common ones are the use for & in place of And and the use of 0x for hex numbers rather than $.

How difficult would it be for Swordfish to accept both options? I'm sure there are others - Or and Not come to mind for example.

Also, it would be useful if there was some way in the IDE for it to highlight the point at which it 'gives up' so it is easier to track down the error.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Tue Aug 06, 2013 11:16 am

> How difficult would it be for Swordfish to accept both options?
> I'm sure there are others - Or and Not come to mind for example.

I understand what you are saying but I think such a change would not benefit Swordfish in general.

> Also, it would be useful if there was some way in the IDE for it to
> highlight the point at which it 'gives up' so it is easier to track down
> the error.

It does this already, it tells you the point it failed. If you give me an example of some code and resulting error that doesn't do this, I would be more than happy to take a look for you.

blackcattech
Posts: 113
Joined: Mon Jan 11, 2010 10:39 pm
Location: Chesterfield

Post by blackcattech » Tue Aug 06, 2013 2:22 pm

David Barker wrote: I understand what you are saying but I think such a change would not benefit Swordfish in general.
Fair enough - I'd say if any other users comment on the thread that would give a more representative feeling. To me, allowing all 'common' ways of doing basic things opens the language and avoids putting people off from having to learn the peculiarities of a new syntax. However, I'm not the one writing the compiler and there may be good reasons for not doing it unless a lot of users feel it would be beneficial.
David Barker wrote: It does this already, it tells you the point it failed. If you give me an example of some code and resulting error that doesn't do this, I would be more than happy to take a look for you.
I think I've explained myself badly. The compiler does highlight errors, it is the preprocessing in the IDE that I'm talking about. It stops automatically adding functions, subs, variables etc to the code explorer when it encounters something unexpected, but doesn't seem to highlight the actual item which is confusing it. I've now learned that you can work out the sub where the error is based on what is added to the code explorer, but if you are writing a large sub or function is can take a while to identify the actual error.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Tue Aug 06, 2013 2:31 pm

> I think I've explained myself badly. The compiler does
> highlight errors, it is the preprocessing in the IDE

I agree it would certainly be nice to highlight an error in the IDE and something I may look at implementing in the future, time permitting.

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Tue Aug 06, 2013 5:18 pm

Fair enough - I'd say if any other users comment on the thread that would give a more representative feeling
I'll butt in. I'd love it if Swordfish accepted my C syntax too (which like you I do more often than not), but unfortunately I probably have to agree with David on this one.

Swordfish is already different enough from what most folks think of as BASIC that extending it too much more would likely confuse things. From what I've seen I think people who've used different languages seem to appreciate SF, while beginners have a hard time getting their head wrapped around it.

Of course, actually READING the manual would help a lot.
I've now learned that you can work out the sub where the error is based on what is added to the code explorer, but if you are writing a large sub or function is can take a while to identify the actual error
When things don't compile, scroll down to the bottom of the error window to the "last one" (which is actually the first error) and click on it. Work on resolving that one and many times a lot of others disappear. Sometimes it can be tricky as the real error is in a previous line, but it usually gets me in the neighborhood.

Post Reply