Skip to content

Conversation

@mio-19
Copy link
Contributor

@mio-19 mio-19 commented Feb 4, 2020

generate more elegant code

it get rid of

function(...){
return function(...){
return function(...){
return function(...){
...

@mio-19 mio-19 requested a review from antfu February 4, 2020 08:45
@mio-19 mio-19 changed the title js: functional and modern syntax [WIP] js: functional and modern syntax Feb 4, 2020
@LingDong-
Copy link
Member

Looking great, let me know if it's ready for merging, thanks!

@mio-19 mio-19 changed the title [WIP] js: functional and modern syntax js: functional and modern syntax Feb 7, 2020
@mio-19
Copy link
Contributor Author

mio-19 commented Feb 7, 2020

it's ready for merging

@LingDong-
Copy link
Member

Thanks!

I see you did a x=>y=>z=>{} to get rid of funcurlvls, pretty neat.

I'm thinking if functions should still be initialized to ()=>0. All other types initialize to a value. Numbers to 0, Bools to false, Objects to {}. I know user shouldn't need to use a function before it is defined, but let's not make assumptions. This also makes runtime typechecking more consistent.

One thing that is debatable is that maybe we can return _=>_ the identity function instead. I guess either is quite reasonable.

What do you think?

@mio-19
Copy link
Contributor Author

mio-19 commented Feb 8, 2020

I think _=>{} is more reasonable

@LingDong- LingDong- merged commit 3713093 into wenyan-lang:master Feb 8, 2020
@LingDong-
Copy link
Member

Thanks a lot!

@mio-19
Copy link
Contributor Author

mio-19 commented Feb 8, 2020

@LingDong- Screenshots and CHANGELOG need to be updated

@antfu antfu mentioned this pull request Feb 19, 2020
@mio-19 mio-19 mentioned this pull request Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants