> Well... In this example, we go down from 9 lines to 7 lines. Ok fair. > But the price is a new syntax to learn: > ////main//// > Is it wise to add an org-mode specific syntax to C++ (which already has > a lot) ? > > Being noisy is a weakness of C++. > I think it is not the responsibility of org-mode to fix that. > > Now, org-mode is already able to process main()-less blocks in simple cases. > > #+BEGIN_SRC C++ > printf("hello\n"); > #+END_SRC > > If we can find a way to extend this feature to more cases, > without needing a long documentation, > then, sure, it would be a nice improvement.
I agree with you. Creating a new syntax is not a good idea. However, in some way, ob-C has created a new syntax implicitly by instantiating a new main in absence of such a function in the source block. So why not to extend this idea by allowing a user defined function to parse the source block. The default function is clearly org-babel-C-ensure-main-wrap. We could create a new header :wrap which replaces :main and holds the user defined function. It can take three values nil, org-babel-C-ensure-main-wrap(default), or user-defined-function. So, in this way user-defined-function holds my own syntax for my future presentation. What do you think ? Best Ernesto