Hi all,

I'm writing following code, because seeking better way to use global struct.

https://github.com/jats-ug/practice-ats/blob/master/extval/main.dats

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

%{^
struct foo {
  int a;
  int *p;
};
struct foo foo_var;
%}

absvt@ype struct_foo
vtypedef struct_foo_impl = $extype_struct"struct foo" of {
  a = int,
  p = [l:addr] (int@l | ptr l)
}
assume struct_foo = struct_foo_impl
macdef takeout_struct_foo = $extval(struct_foo, "foo_var")
extern praxi addback_struct_foo (struct_foo): void

implement main0 () = {
  val foo = takeout_struct_foo
//  val () = foo.a := 1 // error(3): a non-proof component is replaced
of the type[S2Ecst(int)].
  val () = println! foo.a
//  val () = println! foo.p // error(3): the symbol [print] cannot be
resolved as no match is found.
  prval () = addback_struct_foo foo
}
```

However, the code can't touch the member of the struct.
Is it non-sense code?

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/CAEvX6dkaWPg%3Dqi0Crz%2BZGjU8tWD1ixWU7wpe5tdOU1Pi7GrMgg%40mail.gmail.com.

Reply via email to