Typechecking can only be perfomed on ATS code. If you call foofunc in C, there is no safety guarantee.
By the way, the example does not seem to be interesting because barfunc cannot make any real use of pss. On Wed, Jun 15, 2016 at 11:36 PM, Kiwamu Okabe <[email protected]> wrote: > Hi Hongwei, > > On Wed, Jun 15, 2016 at 10:19 PM, Hongwei Xi <[email protected]> wrote: > > foofunc cannot be used as long as there is no way > > to produce a value of the type chss(10). > > > > You can form the type chss(10), but you should allow > > a value of this type to be formed. > > > > For instance, list(string, ~1) is a valid type but there is > > no value of such a type. > > Ah, I understand it. > > However I can write following code: > > ``` > extern praxi lemma_chss {n:int} (!chss(n)): [chss_init <= n; n <= > chss_ilock] void > > fun barfunc (pss: !chss(10) | p: ptr): void = {} > > extern fun foofunc (!chss(10) | ptr): void = "mac#" > implement foofunc (pss | p) = barfunc (pss | p) > ``` > > The code is type-checked. And the `foofunc` function can be called > from C language. > What kind of error does it avoid? > > Best regards, > -- > Kiwamu Okabe at METASEPI DESIGN > > -- > You received this message because you are subscribed to the Google Groups > "ats-lang-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/ats-lang-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dm%3D7BRN%3DN8EssYOtX5gH6E9ZbzO8im676zrcD5fVMjJkg%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLp2%3DgqgcWeouuMSO_Hmvr6zBuHmLMj5_DMPeiC3ik9%3DTw%40mail.gmail.com.
