Compiler error when using fprint_list_vt<charNZ>

25 views
Skip to first unread message

August Alm

unread,
Feb 15, 2017, 3:41:08 PM2/15/17
to ats-lang-users
Hi!

Consider the following minimal working example:

         #include "share/atspre_define.hats"
         #include "share/atspre_staload.hats"
    
        implement main0 () =
        {
            val stringy = "abcdefghijkl;mnopq;rstu;vx"
            val test = string_explode (stringy)
            val () = fprint_list_vt<charNZ> (stdout_ref, test)
            val () = list_vt_free<charNZ> (test)
        }

The code typechecks but does not compile. I get a compiler message that starts out:

"...error: ‘PMVtmpltcstmat’ undeclared (first use in this function)"

and then lists several "ATSINSmove" macros (I can't figure out what that is) that won't compile.

What am I doing wrong?

Best wishes,
August


Hongwei Xi

unread,
Feb 15, 2017, 4:35:08 PM2/15/17
to ats-lan...@googlegroups.com
Templates and dependent types do not mix well.
In general, a dependent type should not be passed
as an template argument. You can do something like:

#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"

implement main0 () =
{
val
stringy = "abcdefghijkl;mnopq;rstu;vx"
//
val test = string_explode(stringy)
//
val ((*void*)) =
fprint_list<char>
  (stdout_ref, $UNSAFE.list_vt2t(test))
//
val ((*void*)) = list_vt_free<charNZ> (test)
}


--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/028c66dc-9cb5-4fb7-9d4e-28c7161e9a4a%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages