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
Feature Request: Object cloning in function parameters #161
Comments
Work-around is:
How would it handle default arguments? To add it to the grammar, would need to have the AST transform this:
into this:
which becomes the javascript: (function(person){
person == null && (person = defaultV);
person = clone$(person);
return person.name;
}); Extended test:
|
You can fudge it using a second parameter: name-to-upper = (person, clone = ^^person)-> clone.name .= to-upper-case! |
Maybe it'd be interesting to have them in other places ? |
Is this feature documented on the site right now? David On Dec 31, 2012, at 3:57 PM, Nami-Doc notifications@github.com wrote:
|
The proposed syntax, yes. |
It would be really cool to be able to declare a function parameter as an object that should be cloned, as opposed to passed by reference. It's really lame how Javascript co-mingles pass by value and pass by reference. Another option would be a flag to pass to the compiler, as I never want pass by reference in any LiveScript code.
The text was updated successfully, but these errors were encountered: