Discussion:
Case semantic
Enrique Iurleo
2012-04-10 22:58:25 UTC
Permalink
Hi list, i have a doubt about the semantic of case. When i execute a case
the system does a unification of the variable and pattern? i mean.. for
example i have:

local X in
X=[1 2 3]
case X of Y|Yr then {Browse Y} {Browse Yr} else skip end
end

In this case when the "Browse" is executed browse "1" and "[2 3]".. so the
environment changes during the case? does the case a unification?

Thanks i hope your answers.
Sébastien Doeraene
2012-04-11 06:18:12 UTC
Permalink
Hi,

No, the case does not do a unification. Indeed, the argument X of the case
is never modified/bound, even partially. However, non-escaped variable
names in the *pattern* do indeed get bound to the corresponding parts in X
(and these variables only belong to the environment in the "then" part of
the given guard).

Does that answer your question?

Sébastien
Post by Enrique Iurleo
Hi list, i have a doubt about the semantic of case. When i execute a case
the system does a unification of the variable and pattern? i mean.. for
local X in
X=[1 2 3]
case X of Y|Yr then {Browse Y} {Browse Yr} else skip end
end
In this case when the "Browse" is executed browse "1" and "[2 3]".. so the
environment changes during the case? does the case a unification?
Thanks i hope your answers.
Enrique Iurleo
2012-04-11 15:25:14 UTC
Permalink
Yes i understand. So the ASA dont change? i mean only change the
environment right? so in my example Y bound to x.1 in the ASA.. am i right?
Post by Sébastien Doeraene
Hi,
No, the case does not do a unification. Indeed, the argument X of the case
is never modified/bound, even partially. However, non-escaped variable
names in the *pattern* do indeed get bound to the corresponding parts in
X (and these variables only belong to the environment in the "then" part of
the given guard).
Does that answer your question?
Sébastien
Post by Enrique Iurleo
Hi list, i have a doubt about the semantic of case. When i execute a case
the system does a unification of the variable and pattern? i mean.. for
local X in
X=[1 2 3]
case X of Y|Yr then {Browse Y} {Browse Yr} else skip end
end
In this case when the "Browse" is executed browse "1" and "[2 3]".. so
the environment changes during the case? does the case a unification?
Thanks i hope your answers.
_________________________________________________________________________________
mozart-users mailing list
http://www.mozart-oz.org/mailman/listinfo/mozart-users
Sébastien Doeraene
2012-04-11 15:36:27 UTC
Permalink
I'm not sure I understand what you mean by "ASA". But if I do, then yes,
you're right.
Sébastien
Post by Enrique Iurleo
Yes i understand. So the ASA dont change? i mean only change the
environment right? so in my example Y bound to x.1 in the ASA.. am i right?
Enrique Iurleo
2012-04-11 16:06:38 UTC
Permalink
Sorry haha.. i mean the Store (the SAS)
Post by Sébastien Doeraene
I'm not sure I understand what you mean by "ASA". But if I do, then yes,
you're right.
Sébastien
Post by Enrique Iurleo
Yes i understand. So the ASA dont change? i mean only change the
environment right? so in my example Y bound to x.1 in the ASA.. am i right?
_________________________________________________________________________________
mozart-users mailing list
http://www.mozart-oz.org/mailman/listinfo/mozart-users
Sébastien Doeraene
2012-04-11 16:21:10 UTC
Permalink
OK, then you were right, indeed. The store is unchanged.
Sébastien
Post by Enrique Iurleo
Sorry haha.. i mean the Store (the SAS)
Loading...