Yes. But datatypes are nominal. Often one uses abstract types to hide information. For example,
abst@ype Point2D #extern fun Point2D_get_x(Point2D): double local absimpl Point2D = @{x=double,y=double} in implement Point2D_get_x(p) = p.x end On Sat, Aug 8, 2020 at 11:33 AM Timmy Jose <zoltan.j...@gmail.com> wrote: > > Hello, > > I was trying out some experiments as part of my learning process. The > small program below typechecks and runs correctly: > > typedef > point2D = @{ x = double, y = double } > > typedef > coord = @{ x = double, y = double } > > fn > display_point (name: string, p: point2D): void = > (println! ("[", name , "] x = ", p.x, "y = ", p.y)) > > implement main0 () = { > val origin = @{ x = 0.0, y = 0.0 }: point2D > val () = display_point ("origin", origin) > val () = println! ("x = ", origin.x, ", y = ", origin.y) > > val coord0 = @{ x = 0.0, y = 0.0 }: coord > val () = display_point ("coord0", coord0) > } > > So I'm assuming that typing in ATS is structural instead of nominative > since the `display_point` functions works for both `point2D` and `coord` > values? > > Just wanted to confirm this. Thanks! > > Best, > > Timmy > > -- > 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-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ats-lang-users/0d2e897a-5693-40f8-b268-60da5b71ac26n%40googlegroups.com > <https://groups.google.com/d/msgid/ats-lang-users/0d2e897a-5693-40f8-b268-60da5b71ac26n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLrn_hDuaYvnWygByVgdBodvy-_qd8J6V-KHpBCdLOR9KQ%40mail.gmail.com.