[m-users.] Seeking some feedback on FFI style...

Sean Charles (emacstheviking) objitsu at gmail.com
Sun Aug 7 19:02:49 AEST 2022


Duly noted. Yes, I can understand that.

What I will do is replace the calendar.det_ for the semidet versions, and change the statinfo/0 structure members to be maybe(date) as a compromise for this example. Going forward though I have taken all your comments and put them in my stickes.app note for 'Stuff to remember when doing FFI'. :)

Thank you very much for the feedback.

Sean/



> On 7 Aug 2022, at 09:45, Julien Fischer <jfischer at opturion.com> wrote:
> 
> 
> 
> On Sun, 7 Aug 2022, Sean Charles (emacstheviking) wrote:
> 
>> Feedback changes made. I also noticed on filestat4/4 that I am using
>> 'det_' versions of functions for building a dalendar date, so that
>> also was a reason to remove 'will_not_throw_exception` as well I
>> guess?
> 
> Yes. That said, if I were writing that predicate I would arrange things
> so as to avoid potentially throwing a Mercury exception across the
> Mercury-C boundary**, e.g. by having to_date/6 return a maybe(date)
> value and constructing the statinfo/0 value by the caller of the foreign
> code instead of using a callback within it.
> 
> (** throwing Mercury exceptions across this boundary is not supported in
> general.)
> 
> Julien.



More information about the users mailing list