It looks like you're new here. If you want to get involved, click one of these buttons!
Hello everyone, what do you think about a C mode for Processing or a C wrapper for some functions of Processing?
I just recently discovered Python mode for Processing and found it to be a huge motivator for finally learning Python. There is an R-mode and the P5.js mode as well. All these try to support Processing with their native languages (instead of trying to transpile it, like Processingjs does, which is useful in a different way).
Instead of re-implementing Processing for say D, Mathematica, Haskell, Haxe or Rust, a lot of this work could be simplified by writing a C-mode first. Then one would only need to create a thin wrapper for these C functions. Edit: This idea might come closest to the Coffescript mode for Processing, where Processingjs made it very easy to add a new Coffeescript mode to Processing.
Since C is quite low-level it might not support some features from Java, which would break the C-mode. For example classes behave a lot differently, than C structs. However I don't really see any big flaws, since most functions don't require very Java specific features such as polymorphism or interfaces (am I mistaken?) One might need to cut some corners and define enums as integers or structs to make bindings easy to include into other languages though.
The higher level constructs could then be used by each language in their respective ways. D handles arrays a lot differently than Haskell for example.
The one downside I see with this approach beside the limitations of C: Processing itself is basically a Java wrapper around OpenGL and some other libraries for sound, etc., which would basically make a C-mode a wrapper around OpenGL. This might seem to make the C-wrapper a bit redundant. On the other hand I would love to use Processing syntax when programming C, instead of using OpenGL or Vulkan. It would be especially nice if one could switch the modes with a single command.
What are your thoughts on this? Do you think it would be feasible and useful? Are there any major points I missed, which would make writing a C-mode impossible or redundant?