aaron wrote:... an attachment to the IDE that runs a first pass through the code, extracts all the procedure names and re-writes them as declares, and then either jams them into the top of the source code or into a second include file.
But than all structures have to be extracted and put before all declares, because there could be structure pointers as procedure argumnts! And the structures also have to be in the right order!
Does anyone know of such a plugin? At times, it would ease the pain of rearranging procedures in the proper order so it can compile.. of course declares are the answer but creating these (when there are lots of procedures) is not productive use of time. If we can't have 2-pass compiler support, at least it would be great to have an automated process in the IDE to properly build these declares.
In doing a search for the above, seems that others agree that a 2-pass compiler is handy for another reason -> not compiling unused procedures.
it's not too difficult to build, the major problem would be line number mismatch for error reporting, unless all declares would be in an included file...
hmm...
that just might work...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
blueznl wrote:all declares would be in an included file...
Personally, that would be ok with me - then these are out of your face, and you can code with confidence (not worrying about procedure ordering). It would be great if you can make a tool or plug-in.
Personally I like to code with a single pass compiler for various reasons
1) Speed; a single pass compiler as you know takes seconds to compile it makes debugging so much easier and less frustrating to wait for it to compile (like in C++)
2) One Less thing to keep track of; If you know the order of everything works then you don't have to worry about if it is declared in this file or that file first, Xinclude helps if it doesn't pick up like it should
3) Coding ethics; I like to keep my code nice, clean, and readable the single pass keep everything readable you can visually see how things can be declared and are at. You will always know the area were previously declared code is, instead of asking where the hell did that structure/procedure come from? a double pass compiler could allow for code to look pretty tangled and far from orderly.
I didn't realize PureBasic has a one-pass compiler until I started reading Kale's book. I too would be keen for a two-pass option in the future because I'm so used to the latter. However, I do understand that it is not likely to happen, nor should it be one of Fred's priority!