Recursion in views cannot be handled this way. You need to define
dataviews for this.

On Friday, August 19, 2016 at 7:01:35 AM UTC-4, Kiwamu Okabe wrote:
>
> Hi all, 
>
> Now I'm trying to define mutual struct: 
>
> https://github.com/jats-ug/practice-ats/blob/master/struct/main.dats 
>
> They are defined following in C: 
>
> ``` 
> {^ 
> struct foo; 
> struct bar { 
>   int a; 
>   struct foo *p; 
> }; 
> struct foo { 
>   int b; 
>   struct bar *p; 
> }; 
> %} 
> ``` 
>
> And they are imported into ATS world with following: 
>
> ``` 
> absvt@ype struct_foo 
> vtypedef struct_bar = $extype_struct"struct bar" of { 
>   a = int, 
>   p = [l:addr] (struct_foo@l | ptr l) 
> } 
> vtypedef struct_foo_impl = $extype_struct"struct foo" of { 
>   a = int, 
>   p = [l:addr] (struct_bar@l | ptr l) 
> } 
> assume struct_foo = struct_foo_impl 
> ``` 
>
> But the code using these causes compile error at ATS... What's wrong??? 
>
> ``` 
> implement main0 () = { 
>   var foo: struct_foo 
>   var bar: struct_bar 
> //  val () = foo.p := (view@bar | addr@bar) // Error! 
> //  val () = bar.p := (view@foo | addr@foo) // Error! 
>   val () = println! (foo.p) 
>   val () = println! (bar.p) 
> //  val () = println! (foo.a) // Error! 
> //  val () = println! (bar.a) // Error! 
> } 
> ``` 
>
> 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/477bf0b8-ac69-4a17-be00-b6aaf8d74370%40googlegroups.com.

Reply via email to