[Gambas-user] C like #include for Gambas

jm joem at ...2671...
Tue Jun 12 11:41:50 CEST 2012


Richard,

You got same ideas I got!

I was going to write a gambas program to do the preprocessing, but
backed off because the issue then became which programs do you maintain?
The expanded ones that the IDE can run or the compact ones 
edited in a text editor without highlighting.
Lack of highlighting hugely reduces productivity.

[That leads to be another question for the knowledgeable.
 Does Gambas have any way of exporting IDE highlighted code as HTML?
 It will greatly assist me to have this feature when documenting code.
 "save highlighed code in html" turns up lots of results in google
 "gambas save highlighed code in html" turn up nothing relevant]


I trying an alternative work around as well where I use huge switch
statements. The constant that the switch statement execute are highly
verbose. e.g.

PRIVATE CONST CHANGE_BASE_COORDINATES_OF_FEET AS Integer = 4

and then calling a function like this:

   geometry(CHANGE_BASE_COORDINATES_OF_FEET)

and then in that function I have a huge switch statement.
I use OO almost everywhere, but this technique reduces the amount of OO
based dereferencing notation code. Code looks closer to C.
Code works well, and expands well.
The only thing lacking is the ability to use #include to
shovel the big switch functions to some other file to make files
even more readable.

Because I work in C, gambas, and other languages
I am conscious not to use language specific syntax wherever
possible. I've prototyped programs in gambas and gone to C this way. So
I know it works reasonably well providing you don't get too welded
to language specific code.

So for many different reasons which can't all be quickly covered in a
mailing list, and without getting into the merits
of OO only solution, (or bashing OO to justify adding #include) I
thought best to ask if C like #include and related pre-processing can be
added. It can all coexist and work well when used responsibly
for the many different coding styles that exist out there.



On Mon, 2012-06-11 at 20:27 +0100, RICHARD WALKER wrote:
> With apologies to all-who-know-more-about-this-than-me (or just "all")...
> 
> Joe, you have a problem with managing a growing Gambas codebase and
> you think having an #include method in Gambas would help you cope. We
> are agreed that if it were added then it would operate before the
> compiler kicks in to make code for the interpreter. That makes me ask
> the question; why reinvent the wheel?
> 
> 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?
> 
> You have another program which is ideally suited to managing the files
> for large text file processing projects. Why not have a go at knocking
> up a project definition file using all the #include and #define and
> #ifdef directives you need. Run that through the C pre-processor,
> maybe under the direction of a suitable makefile and see if you can
> create a Gambas project which the ide can then load (for checking?)
> and compile?
> 
> This should work just as well for the forms as for the code as it is
> all just text files in the project. Could that work for you?
> 
> Richard
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> ______________________________________________________________________________
> This message has been checked for viruses and spam by Armourplate
> http://www.armourplate.com, the email archiving, anti virus and anti spam
> service from Corpex.


______________________________________________________________________________
This message has been checked for viruses and spam by Corpex using
the ArmourPlate Anti Virus and Anti Spam Scanning Service.
To find out more and see our email archiving service see
http://www.armourplate.com or call Corpex on UK 0845 050 1898.




More information about the User mailing list