With this style, you do not really need the following types:

absvtype struct_foo_ptr(l:addr) = ptr l
absvtype struct_bar_ptr(l:addr) = ptr l

If an at-view T@l for a pointer ptr(l) can be found, the system assumes
that the pointer is not NULL. You may use a run-time check to solve this
issue (or use optional views).

My concern with this style is that it is still very verbose in practice.
To get something closer to the C style, I think that having abstract types 
like
struct_foo_ptr and struct_bar_ptr is a better way to go.

On Saturday, August 27, 2016 at 8:44:44 AM UTC-4, Kiwamu Okabe wrote:
>
> On Sat, Aug 27, 2016 at 8:38 PM, Kiwamu Okabe <...> wrote: 
> > * Easily support double pointer struct member such like `struct foo 
> **p;`. 
>
> I tried to write that as following: 
>
>
> https://github.com/jats-ug/practice-ats/blob/a3cfedca36459d7fb5b26ddfbba62de237900902/mutual_struct2/gen.sats
>  
>
> https://github.com/jats-ug/practice-ats/blob/a3cfedca36459d7fb5b26ddfbba62de237900902/mutual_struct2/main.dats
>  
>
> However, I have a question. It can dereference pointer without 
> checking that it doesn't equal NULL: 
>
>
> https://github.com/jats-ug/practice-ats/blob/a3cfedca36459d7fb5b26ddfbba62de237900902/mutual_struct2/main.dats#L23
>  
>
> ``` 
> val () = if !pbarptr > 0 then print_bar (pfbar | !pbarptr) // Why need 
> no checking `pbarptr > 0`? 
> ``` 
>
> I think `pbarptr` should depends on `{l:agz}`, not `{l:addr}`. Isn't it? 
>
> 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/843b39cf-39ca-4fab-8caa-6e9ff8478152%40googlegroups.com.

Reply via email to