MantisBT - OCaml
View Issue Details
0006151OCamlback end (clambda to assembly)public2013-08-30 18:262016-12-07 10:46
closedwon't fix 
0006151: Misc.Fatal_error when using "%apply" for more arguments.
I'm not really sure this is really a bug or "working as intended" but the joined file doesn't compile with the following message :

>> Fatal error: Cmmgen.transl_prim_3
Fatal error: exception Misc.Fatal_error

It does of course compile (and give the expected result with the signature :
('a -> 'b) -> 'a -> 'b

Also, and this is probably a bigger issue, the first line alone compile just fine as long as ap2 is not used.
No tags attached.
related to 0007408acknowledged  Compile-time fatal error when we write external definitions with wrong signatures 
? (83) 2013-08-30 18:26
Issue History
2013-08-30 18:26drupNew Issue
2013-08-30 18:26drupFile Added:
2013-08-31 00:50meyerNote Added: 0010279
2013-08-31 00:51meyerStatusnew => closed
2013-08-31 00:51meyerAssigned To => meyer
2013-08-31 00:51meyerResolutionopen => fixed
2013-09-06 02:22drupNote Added: 0010317
2013-09-06 02:22drupStatusclosed => feedback
2013-09-06 02:22drupResolutionfixed => reopened
2013-09-11 22:22doligezNote Added: 0010340
2014-01-21 14:01doligezAssigned Tomeyer =>
2014-01-21 14:53doligezPrioritynormal => low
2014-01-21 14:53doligezStatusfeedback => confirmed
2014-01-21 14:53doligezTarget Version => later
2016-12-06 23:07shinwellNote Added: 0016685
2016-12-06 23:08shinwellStatusconfirmed => closed
2016-12-06 23:08shinwellResolutionreopened => won't fix
2016-12-07 10:46xleroyRelationship addedrelated to 0007408
2017-02-23 16:35doligezCategoryOCaml backend (code generation) => Back end (clambda to assembly)
2017-02-23 16:44doligezCategoryBack end (clambda to assembly) => back end (clambda to assembly)

2013-08-31 00:50   
I think it's reasonable to assume that all the builtins have fixed signature that match the one declared as data type. We should close this PR as variable arity %apply is a bad idea. On other hand "lambda" intermediate language supports only simple single argument apply.
2013-09-06 02:22   
The fact that this code don't compile is fine, but the error reporting should be clearer and a type check should be done at the definition, not as the use.
2013-09-11 22:22   
By using external, you are giving up your right to static type checking, so in my opinion you should be happy to get an error at compile-time and not a segment violation at run-time.

That said, if there is a simple way of giving a better error message, I'm in favor of implementing it.
2016-12-06 23:07   
I think there are many higher-priority items on the agenda. Furthermore, use of % primitives outside the compiler distribution is not to be encouraged---if you play with fire, you should expect to get burnt occasionally. Closing this issue; please submit a patch via Github if you feel strongly enough.