-
Notifications
You must be signed in to change notification settings - Fork 77
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
auto-wrap enhancement #628
Comments
PS: a different notation instead of tuple brackets would also be nice perhaps. |
I think the tuple thing is unneeded. The others, well, it's like the good old days of ASF+SDF! Just parse it. |
Yes, just like ASF+SDF, although I think this feature is more like Scala's implicits than anything else. I don't think the feature is easy to implement actually, given type inference, but we are helped with the syntax for literals which is unambiguously typed. Otherwise I am interested to hear wat @mahills thinks about this from the perspective of the type checker. |
I'm not sure it's particularly troublesome from the type checking perspective, although the code for checking pattern matching and binding types to introduces names is already fairly complex -- we should be fine if we make tight rules about when this can be used (basically, nothing ambiguous). Then, of course, we need the checks to tell if uses are ambiguous :) I am more worried about maintainability of programs using this feature, since you would have some constructors appearing explicitly, and some not appearing at all, making it harder to understand programs using larger data definitions that you didn't write yourself. We would probably want UI support to "desugar" this (maybe something if you hover over it) so you could see the explicit definition, or maybe even an option to expand and replace in-place if you were writing it this way just to save some typing. |
I agree that implicit stuff makes code harder to understand and I like the On Mon, Aug 4, 2014 at 10:50 PM, mahills notifications@github.com wrote:
Jurgen Vinju
|
On the one hand: yes back to good old ASF+SDF times. On the other hand our current situation is much better: in the ASF+SDF setting we were hindered by syntactic ambiguities and here we have much better control. I particularly like the possibility to write literals in AST without wrappers like Another application: in the Figure library there are cases where you want to mix integers and strings, For instance,
Now the keyword parameter
and |
@tvdstorm About the tuple thing, the motivation is that right now we use
@PaulKlint yes, removing the brackets is also interesting, but it involves On Mon, Aug 4, 2014 at 11:53 PM, Paul Klint notifications@github.com
Jurgen Vinju
|
When constructing or pattern matching large data types the number of names and brackets is often an impediment. People sometimes use aliases over tuple types to circumvent this problem. Aliases have their issues and we prefer everybody to use clear and simple data types, so we need something to solve the syntactic vinegar.
One idea would be to have the type checker infer constructors (probably functions in general).
Examples:
Further support for avoid naming unambiguous constructors:
If there is another definition for E then the checker complains:
The text was updated successfully, but these errors were encountered: