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

Lambda function #1234

Closed
stevefan1999-personal opened this issue Jun 16, 2022 · 3 comments
Closed

Lambda function #1234

stevefan1999-personal opened this issue Jun 16, 2022 · 3 comments

Comments

@stevefan1999-personal
Copy link

It would be cool if we can have lambda functions

workspace := `$env.PWD`
out_dir_prefix := workspace + '/out'
out_dir_profile := fn (profile) => clean(join(out_dir_prefix, profile))

build-kern profile='dev':
    cargo build -Z unstable-options --profile {{profile}} --out-dir {{out_dir_profile(profile)}}

Related: #799 #277

@casey
Copy link
Owner

casey commented Jun 20, 2022

There's actually an issue and PR for custom functions: #1059 and #1060. Would that cover your use-case? Lambdas are unlikely to be implemented any time soon, because they would complicate the type system.

@stevefan1999-personal
Copy link
Author

stevefan1999-personal commented Jun 20, 2022

@casey Agreed...I tried implementing Hindley-Milner Type Inference on my own and it is exceedingly difficult for me...And HM is almost a must for lambdas. I didn't thought just implemented a strongly typed system though.

Closing this as a duplicate

@casey
Copy link
Owner

casey commented Jun 20, 2022

@casey Agreed...I tried implementing Hindley-Milner Type Inference on my own and it is exceedingly difficult for me...And HM is almost a must for lambdas. I didn't thought just implemented a strongly typed system though.

Just sort of has a static type system. There is only one type, that of "string", but static analysis is performed to make sure that all variables exist.

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

No branches or pull requests

2 participants