[Gambas-user] C like #include for Gambas

Rolf-Werner Eilert eilert-sprachen at ...221...
Tue Jun 12 16:14:41 CEST 2012


Am 12.06.2012 13:41, schrieb Benoît Minisini:
> Le 12/06/2012 13:01, jm a écrit :
>> On Tue, 2012-06-12 at 12:03 +0200, Rolf-Werner Eilert wrote:
>>>> You already have at your disposal a program which fully understands
>>>> what to do with #include (and all the other pre-processor directives
>>>> which have been mentioned). Have you tried it out yet?
>>>>
>>>
>>> Is it possible to insert the C pre-processor into the Play-Button
>>> function of the Gambas IDE, maybe the way you can insert filters into
>>> kprinter? That would be ideal here.
>>>
>>> Just an idea... :-)
>>>
>>> Rolf
>>
>> Wow!
>>
>> Thinking about it, that is even more powerful to cooperate
>> with external preprocessor than just adding preprocesor functionality on
>> its own.
>>
>> A simple check box in project properties dialog box to enable/disable
>> preprocessing can turn the feature on/off. Some programs you may just
>> not want to allow preprocessing and so checking it off here will allow
>> the compiler to complain bitterly to go get it fixed.
>>
>
> Hi,
>
> Sorry if I disappoint you, but I'm strongly against any preprocessing
> feature in Gambas.
>
> I'm talking about code subsitution, not the features currently
> implemented in the Gambas compiler, that just allow compiling one part
> of the code or another.
>
> Why ?
>
> Preprocessing is mainly used (in C) for the three following reasons:
>
> 1) Function and variable declaration.
> 2) Writing the same repeating pattern once.
> 3) Writing generic functions.
>
> In interpreted OO languages, and especially in Gambas, these features
> are not needed:
>
> 1) Function and variable declaration are done automatically by the compiler.
> 2) OO has inheritance.
> 3) There is no templates (or 'generic') in Gambas as in Java. But you
> have the Variant datatype.
>
> Moreover, preprocessing makes programs mostly unreadable, can create
> very difficult bugs, make the source code impossible to analyze (bye-bye
> automatic completion...), and so on.
>
> Developing a program is 20% writing it and 80% debugging it. So
> preprocessing makes that worse.
>
> If you need preprocessing in your project, then I think there is a
> fundamental design flaw in it. I have never need it when writing any big
> Gambas project.
>
> Regards,
>

Sigh... the master has spoken :-)



Regards

Rolf





More information about the User mailing list