Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return value of assignment expression #2352

Closed
bobzhang opened this issue Dec 12, 2017 · 0 comments
Closed

return value of assignment expression #2352

bobzhang opened this issue Dec 12, 2017 · 0 comments

Comments

@bobzhang
Copy link
Member

let f x = 
  x##hey#= 0
let () = f [%raw {| {hey : 3} |}]          

Generated code:

function f(x) {
  return x.hey = 0;
}
var x = ( {hey : 3} );
x.hey = 0;

Two questions:

  1. shall we enforce the return type of assignment to be unit? or just assignment expression
  2. if enforced to be unit, the generated code would be
function f (x){
  x.hey  = 0
  return 0 /* unit */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant