-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat(askscript): function type constructor #42
Conversation
This PR changes function type used in .ask files to a new syntax. |
Also, this PR goes beyond the priorities from our Roadmap. |
@czerwinskilukasz1 I'm all for creating some syntax sugar to make it easier to use, see #49 |
@mhagmajer , is this PR ready for review? I'd say no, because it links issue #49 , which is about a syntax sugar |
@czerwinskilukasz1 this is not the recommended syntax for function type. This is an implementation detail - all types need constructors which are function that result in the given type. Function is a type of value so we need a function constructor for it. We can then have additional syntax sugar for it. Because types are not checked by runtime yet, I created this PR only for the tests to showcase the basic syntax for creating function types. Examples of function constructors:
|
The ticket description as well as your description in this PR and our discussion in this PR were about a different feature than you mentioned today. |
@czerwinskilukasz1 can you explain please? I meant this PR to introduce the generic function type constructor |
Of course. The linked issue is about |
I find |
@czerwinskilukasz1 all syntax sugars are useful to make writing code easier :) |
fun(returnType, arg1Type, arg2Type, ..., argNType)
Last argument can be rest in this case last argument is
true
:fun(string, array(number), true)
- same as(s: string, ...numbers: number[])
in TypeScriptExamples