Re: [fpc-pascal] Merging units
Op 2020-10-02 om 19:55 schreef Ryan Joseph via fpc-pascal: Something that's bothered me for a while I wanted to ask about. I have a package I want to distribute which has 2 or more units, all of which are required to use the package. Technically all the code should be in one file but because units are a nice feature of Pascal we like to keep our code separate when we develop. Usually what happens is we compromise and do either: 1) Have the user of the package add all the units to the uses clause of every file which needs it. This is annoying for the user because it bloats the uses section but for the developer our code is nicely separated into units. 2) Break the units into include files and wrap the interface/implementation blocks in ifdefs. This is nice for the user because they only have a single unit to use but now the developers of the package have to work in what are essentially header files (like in C). The RTL is of course filled with examples like this. In some cases you can also move types and consts to a secondary unit, but alias them in the primary one. Like e.g. Unixtype (what unit you say? Never heard of it? That is because the types are aliased into core units baseunix and unix) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Merging units
Am 02.10.2020 um 19:55 schrieb Ryan Joseph via fpc-pascal: Any ideas of solutions or preferred approaches? Is it feasible to add an "imports" clause to Pascal or are there other pitfalls? The preferred solutions are indeed either to put everything in one unit (includes or not) or to have the user add multiple units. Though the later isn't that much of a problem when one uses a capable IDE that can help here. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Merging units
Something that's bothered me for a while I wanted to ask about. I have a package I want to distribute which has 2 or more units, all of which are required to use the package. Technically all the code should be in one file but because units are a nice feature of Pascal we like to keep our code separate when we develop. Usually what happens is we compromise and do either: 1) Have the user of the package add all the units to the uses clause of every file which needs it. This is annoying for the user because it bloats the uses section but for the developer our code is nicely separated into units. 2) Break the units into include files and wrap the interface/implementation blocks in ifdefs. This is nice for the user because they only have a single unit to use but now the developers of the package have to work in what are essentially header files (like in C). The RTL is of course filled with examples like this. It feels to me like Pascal is missing a way to have the compiler help you make these "umbrella" units so we default back to C-like techniques which we've been using since the 90's. I see things like this from other newer languages and it seems like something Pascal should have given the already existing module structure we take for granted but languages like C don't have. unit test; imports (A, B, C) from SomeUnit, OtherUnit; // types/functions are imported into the unit and accessible from the outside end. Any ideas of solutions or preferred approaches? Is it feasible to add an "imports" clause to Pascal or are there other pitfalls? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TFPGMapObject duplicate errors
> On Oct 1, 2020, at 7:00 PM, Vojtěch Čihák via fpc-pascal > wrote: > > I looked to code, it gives error only when map is Sorted=True. > Thanks. Sneaky that sorted had to be set to true. Not sure why that would be. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal