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

Remove asType [type] Exp in favor of function call: #Sort ( Exp, Kwparams) #889

Open
jurgenvinju opened this issue Nov 9, 2015 · 1 comment

Comments

@jurgenvinju
Copy link
Member

A parser is a function from str to Tree anyway and we might as well use the function call syntax for this instead of having an entire operator dedicated to this. If we look at a reified type as a parser function, we might start writing this:

  • #Statement ( "if (true) println(\"hello\");", origin=myLoc)

It's nice that functions can have keyword parameters, i.e. to provide the origin of the string, etc. Now we call the parse function from the standard library all the time instead of using [Statement] "if (true) println(\"hello\");", simply because we can't pass the necessary parameters.

This would make Rascal smaller. Which is also a good thing.

It is of course an addition for the type checker (a special case for callortree), where the return type of calling a parser is equal to the reified type. This mimicks the behavior of the [...] operator in this respect.

Comments welcome.

@tvdstorm
Copy link
Member

tvdstorm commented Nov 9, 2015

+1. This also ties in a little with "applying" maps, relations and lists (in addition to []).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants