[Gambas-user] C like #include for Gambas
Jussi Lahtinen
jussi.lahtinen at ...626...
Sat Jun 9 15:18:10 CEST 2012
> C thrives on #include without showing signs of design problems.
>
Yes, I know, I wasn't talking about C, I was talking about object oriented
language, Gambas.
> Tens of thousands of external lines of code can be pulled in with
> a dozen #include statements, leaving the code completely manageable,
> readable and a lot more powerful than any other competing method.
>
Yes, but you use #include with libraries, not with programs that aren't
designed for that.
Or you have design problem.
For example, in module_a.module you might have
>
> ...
>
> and in a file called initialise_csv_variables.include it would contain:
>
> PRIVATE WordMarker1 AS Integer
> :
> '200 further variable declarations and initialisations
> :
> PRIVATE sParameterNameArray AS NEW String[MAXIMUM_CSV_PARAMETERS]
> PRIVATE sParameterValueArray AS NEW String[MAXIMUM_CSV_PARAMETERS]
>
> The #include files can contain any amount of well trodden
> proven gambas code which is maintained in only one file.
>
So, basically you would add module/class called initialise_csv_variables,
and you use that module/class in modules a and b.
> I will argue that adding C like #include functionality saves a ton of
> work in mega programs which are already working well, but now
> needs to be expanded even further.
>
I don't understand how.
You would still need to write that initialise_csv_variables.include file,
you could as well write it as module/class.
Jussi
More information about the User
mailing list