let/where vs. local

52 views
Skip to first unread message

aditya siram

unread,
Apr 13, 2019, 6:20:43 PM4/13/19
to ats-lang-users
Am I right in thinking that the difference between a let/where and local is that the latter allows sharing scope across multiple declarations whereas the former only allows one?

For example if I wanted local bindings for some 'val a' I could do:

val a = ... where { ... some bindings ... }



or:

local
 
... some bindings ...
in
  val a
= ...
end



but if I wanted share a local scope between 'val a' and 'val b' I'd have to do:

l
ocal
 
...
in
  val a
= ...
  val b
= ...
end



since there is no way to do that with 'let' or 'where'.

Is it correct that this is the only difference?

Thanks!
-deech

Vanessa McHale

unread,
Apr 13, 2019, 6:31:31 PM4/13/19
to ats-lan...@googlegroups.com

Maybe I'm missing what you're saying, but with ATS 0.3.12 I think you can only use local...end at the top level

Cheers,
Vanessa

--
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 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/f0ddb692-7b08-4019-868d-cdf697994bf5%40googlegroups.com.
signature.asc

Hongwei Xi

unread,
Apr 13, 2019, 8:13:31 PM4/13/19
to ats-lan...@googlegroups.com
In ML, 'let' is for introducing a local scope for an expression while 'local' is for
introducing a local scope for declarations.

Reply all
Reply to author
Forward
0 new messages