[Mono-list] Mixing languages within

Miguel de Icaza miguel@ximian.com
Sat, 11 Dec 2004 01:16:34 -0500


Hello,

> I don't know what the .Net standard would have to say about this....
> 
> I would like to mix C# and (say) Hypothetical String Processing Language 
> (HSPL) and (say) Hypothetical Data Processing Language (HDPL) within the 
> same source code file. e.g.
> 
> class mixed {
>      string normal_c_sharp_method() {
>        string ret = null;
> 
>        <region is HSPL>
>           some HSPL...modifying ret
>        </region is HSPL>
> 
>        <region is HDPL>
>           some HDPL...modifying ret
>        </region is HDPL>
> 
>        return ret
>     }
> }
> 
> Is this a crazy idea?

This can be either very simple or very hard depending on the level of
integration that you want to achieve.

On the simple end of the spectrum you might have a pre-processor that
handles the regions of HSPL and produces a new C# file that is later
compiled by the C# compiler.

On the other end of the spectrum, you might actually want to consider
extending the Mono C# compiler and instead of doing a simplistic
macro-processing job, you could probably provide integration between the
two worlds.

Miguel.