It is not clear to me what you mean by 'miss cast'.

Maybe you should use cptr (instead of ptr):

typedef struct_foo = $extype_struct"struct foo" of { 
  b = int, 
  p = cPtr0(struct_bool)
  pi = cPtr0(cPtr0(int))
} 

Honestly, I think 'struct_foo' should be abstract. Functions
like struct_foo_get_b can and probably should be implemented in C directly.

On Friday, August 26, 2016 at 9:46:13 PM UTC-4, Kiwamu Okabe wrote:
>
> Hi Hongwei, 
>
> On Fri, Aug 26, 2016 at 6:38 PM, Kiwamu Okabe <...> wrote: 
> > Truly, we have no method to avoid both miss cast and NULL pointer??? 
> > Or we can avoid them, if drop mutual struct/record and use 
> > singly-pointer-linked struct/record? 
>
> I think the Rust language has a method to avoid both of them: 
>
>
> https://github.com/redox-os/redox/blob/1ce61c3833b55d4724f9a920ce13f637d6faca74/kernel/audio/ac97.rs#L26
>  
>
> If so, Rust is more better than ATS to maintain pointer in struct. 
>
> Of course, Rust doesn't have any dependent types, however I think the 
> language is more safe to maintain memory. 
>
> 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/7b7b6317-47cd-4dc0-a00a-2273807665e9%40googlegroups.com.

Reply via email to