Date:
2020-04-24 04:07 |
Priority:
3 |
State:
Closed |
|
Submitted by:
Bug Submitter (webuser)
|
Assigned to:
John Reppy (jhr)
|
Machine Architecture: None |
Operating System: Generic Unix |
Component: Basis Library |
Resolution: Fixed |
Severity: Minor |
OS Version:
|
SML/NJ Version: v110.81, v110.96 |
|
Keywords: ref |
URL:
|
|
Transcript (of reproduction): - val r = ref 1;
val r = ref 1 : int ref
- val (a,b) = (Ref.exchange (r,2), !r);
val a = 2 : int
val b = 1 : int |
Source (for reproduction): val r = ref 1
val (a,b) = (Ref.exchange (r,2), !r) |
|
Summary:
Ref.exchange incorrect |
Detailed description |
Ref.exchange seems to have a minor typo in its implementation. It says:
fun exchange (r as ref x, y) = (r := x; y)
However, this doesn't seem to be the intended behavior, which would be:
fun exchange (r as ref x, y) = (r := y; x)
Fix:
fun exchange (r as ref x, y) = (r := y; x)
Submitted via web form by Harrison Grodin <hgrodin@andrew.cmu.edu>
|
|