What's the difference between @uncurry and using the dot syntax?

Consider these two functions:

external f: (. unit => unit) = "f"


external f: @uncurry unit => unit = "f"

I’m using 9.1.4 and both compile, but using @uncurry still results in using Curry._1 while the dot syntax does not.

Am I using @uncurry incorrectly? Is the dot syntax and the @uncurry directive meant to do the same thing? Which is preferred?

You can only use the uncurry decorator for callback functions passed as an argument in an external declaration. here you are applying uncurry to the “whole external function” which is not valid.

So if you want to create an external that accepts a callback, that should be handled like an uncurried function, you’d be using @uncurry. For defining a function you are kinda forced to use (.).

Check the example on the syntax cheatsheet for details on the @uncurry feature: Syntax Lookup