[Gambas-user] C like #include for Gambas
Jussi Lahtinen
jussi.lahtinen at ...626...
Sat Jun 9 15:57:09 CEST 2012
Thinking more closely your problem, I think I know what you need.
You try to avoid writing *many* lines like this;
sParameterNameArray = NEW String[MAXIMUM_CSV_PARAMETERS]
That is caused by broken object design, usually because you need to use old
code which had different approach than OO.
I have had same problems.
I attached my suggestion how to implement this
(IncludeProblem-0.0.1.tar.gz).
Is it working solution?
Jussi
On 9 June 2012 16:18, Jussi Lahtinen <jussi.lahtinen at ...626...> wrote:
>
> 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
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IncludeProblem-0.0.1.tar.gz
Type: application/x-gzip
Size: 5049 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120609/e9bef0bc/attachment.bin>
More information about the User
mailing list