Page 2 of 2

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 12:29 pm
by uwekel
Sounds cool.
+1

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 12:47 pm
by coco2
+1 :D
I like the idea of project code "snapshots"

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 4:50 pm
by Tenaja
PB wrote:Just found out today that this feature would save me a lot of work.
Why? I just loaded an old source of mine that used an IncludeFile.
That IncludeFile has now changed dramatically from what it was
originally, meaning the old source won't compile with it anymore.

If a pre-processor option existed, then my old source would have
had code from the old IncludeFile in it, which means I could still
compile the old code today without problem. Instead, I now have
to fix the "broken" new IncludeFile to work with it. :(

So yes, please implement a pre-processor output very soon. :)
It means that what we compile, can be forever stored as a "gold"
single source file of that app. This is extremely important.
There are not one, but two solutions that already solve the problem you have described. First, you can make a dll. Second, if you are not happy with that, you can make a library file...
http://purebasic.fr/english/viewforum.php?f=26

FWIW, the term you described would more traditionally be precompile, rather than preprocess--which is more accurately described in the first post of this thread. And unfortunately, using that definition, it would not resolve the issue of PB's evolving syntax.

BTW, there aren't really that many issues to deal with...how old is the code you are trying to compile? Why not just update it? The newer versions of PB have more efficient output than the older ones, anyway.

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 5:09 pm
by luis
Tenaja wrote: There are not one, but two solutions that already solve the problem you have described.
There is no problem.

If you use an include in multiple projects, it's obvious if you change the include you have to verify all the projects using it.

If you want to freeze a project in time forever and make it independent from the include, make a private copy of the include in the project folder, and take note of the compiler version used to build the project.

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 5:15 pm
by PB
> make a private copy of the include in the project folder,
> and take note of the compiler version used to build it

Yes, hindsight is 20/20. ;)

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 5:18 pm
by luis
PB wrote:Yes, hindsight is 20/20. ;)
I don't see the connection here. I was merely say to tenaja there was no "problem" to overcome. Just oversight, bad planning, inexperience, call it as you like. :wink:

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 5:37 pm
by PB
> oversight, bad planning, inexperience

That's what the phrase "hindsight is 20/20" means. :)

Re: New compiler option: preprocess only

Posted: Mon Feb 17, 2014 5:48 pm
by luis
BTW: while I like too the original request for the reasons initially stated, maybe it's not a good idea to take a "snapshot in time" this way to save you from the accidental manipulation of external dependencies. Can work in some cases but not all.
For example writing a cross platform program you would probably use a lot of compilerif, and if you try to create the snapshot you would end up with just the code "expanded" on the platform where the snapshot was created. So you have to run it multiple times on the various platforms to have different "single sources" created.
And this is just one of the possible cases.

What I mean is: the single file you would obtain from this feature wouldn't be always lossless relative to what you start with :wink:

Maybe it's easier and less error prone to just make the dependencies private to the projects by cloning them.