sortdef reference = int
typedef reference = [r: reference] int(r)
typedef reference(r: reference) = int(r)
abstype element
stacst not_null(r: reference): bool
extern fun element{r: reference | not_null(r)}(r: reference r): element
[…] and i don't know where to define `not_null` (ATS don't want me to declare it as `extern`), […]
stacst not_null(r: reference): bool
extern fun not_null(r: reference): [b:bool | b == not_null(r)] bool(b)
extern fun not_null(r: reference): [b:bool | b == not_null(r)] bool(b)
--
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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/73dd2c7e-accd-4648-ba12-8dd03db7c653%40googlegroups.com.
extern fun not_null(r: reference): [b:bool | b == not_null(r)] bool(b)The [r] in not_null(r) is unbound.
sortdef reference = int
typedef reference = [r: reference] int(r)
typedef reference(r: reference) = int(r)
abstype element
stacst not_null(r: reference): bool
extern fun {q: reference} not_null(r: reference q): [b:bool | b == not_null(q)] bool(b)
extern fun element{r: reference | not_null(r)}(r: reference r): element
extern fun reference(k: string): reference
val r: reference = reference("foo")
val b: bool = not_null(r)
val () =
if b then
let val e: element = element(r)
in () end
If I understand you correctly, then I think what you
want to do is essentially like 'opt'.
opt(T, true) = T
opt(T, false) = T? // T? means uninitialized T
fun element (opt(T, true)): T // element is just identity
--
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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/83d4c71b-c1ad-41d4-bd15-2240a79c196c%40googlegroups.com.
a piece of memory of the size sizeof(T?).For every type T, T? is a type whose size is the same as T.A value of the type T? can be any sequence of bytes occupying