On 11/11/11 20:18, Phil Clayton wrote:
I am currently implementing
type t
val null : t
val isNull : t -> bool
where type t = CInterface.vol. There is no problem doing this but I
wondered whether I could improve the CInterface structure to avoid
annoying little C library functions.

I have realized that C functions are not necessary to implement these - just to toClong and fromClong:

  val null = toClong 0
  fun isNull v = fromClong v = 0


Would it be at all controversial to include
null : vol
in CInterface?

For a different reason, this could still be useful. I had forgotten that volatiles do not persist in saved states or executables (it should have been obvious from the name) so I can't see how to create such a null value to implement

  val null : t

where type t = CInterface.vol. (There is nothing volatile about null really.)

Perhaps the best approach here is to implement with type t = CInterface.vol option, with NONE representing null.

Phil


_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to