I suspect this would require advanced MMA skills, but it would be very useful if one could modify the front end so that any MMA defined function calls in a Compile[] could be flagged if they are not compilable, because uncompilable functions would cause slow compiled code through calls to MainEvaluate[].
Question 1096 shows how to get lists of compilable functions.
How might the functions in a Compile[] definition be dynamically checked against such a list (i.e. as the user types them) and highlighted in some way if they are/are not compilable?
(I have not yet got around to calling a compiled function from a compiled function, but the obvious next step would be to maintain a secondary list of user defined functions that can be called in a Compile[] and to provide similar highlighting.
Would someone exceedingly smart be able to see how to do both these things?)
UPDATE/Amendment
It has been pointed out in comments and through a linked question, whose significant content I have quoted, that "compilable?" is not a simple question to answer. I would therefore like to amend the question as follows:
How could one customize the front-end (so that feedback is immediate on typing) so that MMA defined functions that are not listed as compilable (whether conditionally or not) are highlighted if used inside a Compile[]?
Rationale: one cannot easily say a function is compilable, but given that there are lists of MMA functions that may be compilable, any function not on that list may be assumed non-compilable and the sooner one can see that the less effort one is likely to waste writing a function for compilation that, ultimately, cannot compile. [The other suggestions may then be incorporated to ease the process of determining whether compilation then actually succeeded without calls to MainEvaluate]
SetSystemOptions["CompileOptions" -> "CompileReportExternal" -> True]
would be somewhat helpful. $\endgroup$f
compilable?" is usually not a simple yes/no? There are often restrictions on the compilable syntax, sometimes very narrow restrictions. $\endgroup$FastCompiledFunctionQ
in (24595 ) is a perhaps more efficient version of Julien'sCompileEx
. $\endgroup$