How to make a constant of size_t type?

68 views
Skip to first unread message

Shea Levy

unread,
Apr 15, 2015, 9:27:13 PM4/15/15
to ats-lan...@googlegroups.com
Hi all,

I’m sure I’m missing something simple, but when I have a line like this:

val x = 10 : size_t 10

I get an error like this:

error(3): the dynamic expression cannot be assigned the type [S2Eapp(S2Ecst(g1uint_int_t0ype); S2Ecst(size_kind), S2Eintinf(10))].
error(3): mismatch of static terms (tyleq):
The actual term is: S2Eapp(S2Ecst(g1int_int_t0ype); S2Ecst(int_kind), S2Eintinf(10))
The needed term is: S2Eapp(S2Ecst(g1uint_int_t0ype); S2Ecst(size_kind), S2Eintinf(10))

The error message seems straightforward, but I’m not sure how to proceed.

Also, is there somewhere I can read more about kinds and tkindef and all? Is it similar to kinds in Haskell?

Thanks,
Shea

Shea Levy

unread,
Apr 15, 2015, 9:32:10 PM4/15/15
to ats-lan...@googlegroups.com
Ah ha, I found it. This fixed it:

val x = (g1int2uint<int_kind, size_kind>(10)) : size_t 10
> --
> 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 ats-lang-user...@googlegroups.com.
> To post to this group, send email to ats-lan...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/5A18670B-6755-4411-920C-0EEFF4E259B4%40shealevy.com.

gmhwxi

unread,
Apr 15, 2015, 9:36:11 PM4/15/15
to ats-lan...@googlegroups.com
Try

val x = i2sz(10)

It is hard to memorize such names. I suggest

val = $UN.cast{size_t}(10)

As long as the actual cast is supported in C, it is fine to do it.


>>Also, is there somewhere I can read more about kinds and tkindef and all? Is it similar to kinds in Haskell?

Not really. A 'tkind' is like an abstract type for which no values can be constructed. You can always do without it.
Reply all
Reply to author
Forward
0 new messages