fbc icon indicating copy to clipboard operation
fbc copied to clipboard

[Feature Request] Add VB-like `while ... end while` (etc) syntax synonyms to provide better consistency for those who desire it.

Open WraithGlade opened this issue 3 months ago • 7 comments

Hey, I'm a newbie to Free Basic and have honestly never really used it except to mess around on it for a few minutes. However, I have repeatedly come back to the website off and on over the years (over a whole decade or more) because the mostly beautiful syntax and the prospect of a more refined alternative to plain C (among other things) attracts me to it significantly at least in principle.

However, one of the things (which is admittedly petty/trivial) that puts me off the prospect of using it a bit is the presence of a handful of syntactic abnormalities that mar what would otherwise be a beautiful syntax. (The other big thing is uncertainty about building a real project on it and problems with installing it such as missing library warnings.)

Anyway, foremost among the syntax turn offs is the while ... wend convention, which is like a giant eyesore on the syntax of the language and a huge inconsistency in the presence of the many other (much more logical) control_structure ... end control_structure style syntax items.

It would be really appealing if Free Basic provided synonyms for all of the control structures that enabled users to use a more logically consistent structure for a better experience. Thus for example, Free Basic could add while ... end while and for ... end for (etc) as synonyms on top of the existing QBasic-like syntax forms, so that a fully consistent convention is available. That way (by being merely synonyms, just as several such syntax synonyms already exist in the language) it wouldn't cause any real harm.

This could also increase the number of Visual Basic (VB) users willing to try Free Basic and make them less likely to be be turned off by Free Basic's syntax convention inconsistencies and would also make Free Basic modestly more compatible with simple cases of Visual Basic code. Naturally, such a move may also attract more maintainers and contributors and users to the project, to the benefit of all.

This feature is very simple would just require adding new syntax forms and thus would probably not be too hard or laborious. Yet, despite how simple the idea is, it could potentially draw in a fair bit of VB users. I'm not personally one (I've never really used Visual Basic either) but I admit that Free Basic and Visual Basic have some very attractive syntax aspects, especially if their syntax were refined just a little bit more.

WraithGlade avatar Sep 30 '25 03:09 WraithGlade

I made a change to allow WHILE / END WHILE. Now it's waiting a possible integration in the official version.

SARG-FB avatar Nov 08 '25 18:11 SARG-FB

Good to hear, SARG-FB. 😎

Hopefully it will get accepted into the language. More consistent syntax would be nice and would make the language more appealing.

WraithGlade avatar Nov 10 '25 20:11 WraithGlade

I did a post on the forum about that subject. Not a lot of replies or interest so not sure it will be in a next version.

If you want I can provided a modified version (1.20 / 64bit) for testing.

SARG-FB avatar Nov 10 '25 21:11 SARG-FB

Ok. It sounds like I should look elsewhere when I want a more syntactically consistent language then.

No worries though. It's the Free Basic team's project to do whatever they want to with, of course. Maybe someone else will make a much cleaner and better open source cross-platform Visual Basic -like language that has C-like performance at some point in the future. As for me, I've been pursuing other languages already anyway (Tcl/Tk 9, Common Lisp, Racket, Factor, C3, and even thinking about writing my own compiler) since I'm not sure of the future of the FB ecosystem anyway.

There's no need to trouble yourself with creating a test version just for me. If the FB community is uninterested in more syntactic consistency then there's not much reason for me to pursue the matter more. It sounds more like a political problem than one of ideas or merit, and as I've been reminded of a few times recently (at much cost to my time) it is often better just to break away at the outset and pursue other avenues entirely than even attempting to bark up the tree of politics/culture.

Anyway, have a good day/night, etc. 🏞️🍀

WraithGlade avatar Nov 10 '25 21:11 WraithGlade

Nobody has yet said it shouldn't be added. It's rather premature to blame politics.

I've never touched VB so wasn't aware it uses end while and end for. If so, that sounds like a decent reason in favour, since FB has apparently borrowed a lot of other syntax as well, although in general, having alternative spellings of the same syntactic forms clearly makes the language syntax worse, not better. Edit: but something like end while is so obvious that offering it as an alternative adds little confusion.

rversteegen avatar Nov 10 '25 23:11 rversteegen

No trouble for a test version as I had made one for my own test.

I didn't say it will not be integrated. It's more because it should be discussed with the dev leader (Jeff). In the proposed version WEND is still valid so not a real problem and as said rversteegen (btw hard to write your name :-) ) end while is obvious more than wend...... End For will not be added as For/Next is deeply in the mind of all the Basic's coders.... Each language has its flaws. Freebasic is powerful so give it a chance.

Have also a good day or day. For me in France now it's the night.

SARG-FB avatar Nov 11 '25 00:11 SARG-FB

Oh, so VB does not have end for, and while some BASIC variants do have it, they seem quite rare, and I doubt you will find any that support both forms. So I think it would require more justification to add it.

Apparently VB 6, VBA and VBscript use wend while VB.NET uses end while.

btw hard to write your name :-)

I'm TMC on the forums/discord.

rversteegen avatar Nov 11 '25 00:11 rversteegen