microsoft / microsoft/pxt-arcade
Named functions not accessible within function
@mmoskal is already working on this.
Since Dec 10, 2019.
- Dominant language
- TypeScript
- Stars
- 546
- Forks
- 263
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 46
Description
Is your feature request related to a problem? Please describe.
named functions (outside of function declarations) can't refer to themselves. This makes names in function expressions
Example:
let hi = function hello() {
alert("hi!");
if (Math.random() < .5) {
hello();
}
}
hi();
(emphasis on the recursive call to hello to make it splash potentially more than once; possible in typescript, but not in pxt)
Describe the solution you'd like
Either add in the named functions behavior as in typescript or document as a minor difference in makecode.com/language / highlight the name in the function expression as not supported (unless it's used in other cases that I haven't thought of)
Just a minor difference I noticed while writing up an appendix lesson on anonymous functions
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.