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

Updates for recent Hy changes #13

Merged
merged 3 commits into from
Oct 16, 2018

Conversation

brandonwillard
Copy link
Member

@brandonwillard brandonwillard commented Oct 1, 2018

Beyond simple syntax and function signature updates, the biggest changes are in the handling/use of—the now missing—cons.

Also, some rules have been added that reflect the Hy language changes made in this commit. Those additions still need tests.

A great test/demo of hydiomatic would be to use itself to apply the changes in this commit! Only a subset of changes could currently be performed with the ruleset additions; the other changes (e.g. the "lifting"/pulling out of conses from quoted forms and additional condes for the strict list type returned by the cons helper function) haven't been added, yet. We might be able to add them, though, and/or use them as an opportunity to demonstrate user-level modifications/additions to hydiomatic rules.

Beyond simple syntax and function signature updates, the biggest changes are in
the handling/use of--the now missing--`cons`.

Also, some rules have been added that reflect these Hy language changes, as
well.  They still need tests.  A particularly good test/demo could involve the
automatic application of these very changes!  Perhaps only a subset could be
reasonably performed, since some changes (e.g. the "lifting"/pulling out of
`cons`es from quoted forms) aren't part of the current rulesets.  We might be
able to add them, or use the opportunity to demonstrate user-level
modifications/additions to the rules.
@brandonwillard
Copy link
Member Author

brandonwillard commented Oct 4, 2018

One test isn't passing and requires the fix from brandonwillard/loghyc#7.

Otherwise, the let/when macro pairing/unpacking rules are causing problems because of changes in the acceptable patterns for let bindings (e.g. from (let [[[a b] [c d]] e] ...) to (let [a c b d e] ...)). As a result, simple bindings like (let [x 1] ...) are mistakenly converted to (let [x None 1 None] ...).

We need a more sophisticated handling that can cover the old and the new patterns. We might get away with separating the old and the new style as configurable options (e.g. source and target version) and let the user pick up the slack. (That sounds lame, though.)
For now, I could simply disable those specific rules so that this PR, and all the language updates, can go through.
@algernon, tell me if you have a preference for one or the other (or even something else).

Also, I'm trying to find a way to automatically add the requires and imports implied by the let and cons changes (i.e. move and removal, respectively). I started putting in rules that would prepend those imports and requires to the relevant uses of let and cons, but that's clearly overkill, so I disabled them for now and made it simply emit a warning in the log.

@algernon
Copy link
Member

There are already rules which aren't enabled by default, adding some more, behind a new flag does not sound wrong. To be honest, I quite like the idea of being able to specify a source and a target version.

(Agree about the require/import stuff, its overkill to add them to every let and cons. The good option would be to treat the whole file as one big, implicit do, and have a rule that finds let/cons anywhere, and adds that to the beginning. And in the end, we unwrap the do and voila.)

@brandonwillard
Copy link
Member Author

(Agree about the require/import stuff, its overkill to add them to every let and cons. The good option would be to treat the whole file as one big, implicit do, and have a rule that finds let/cons anywhere, and adds that to the beginning. And in the end, we unwrap the do and voila.)

Exactly! I just wasn't sure if we would want/need some awareness of scope, but I suppose top-level could do the trick (except for macros, at least until hylang/hy#1682 goes through).

@brandonwillard
Copy link
Member Author

By the way, I think I'll just disable the problematic stuff, let this PR fix the Hy language changes in the core library, and start another for the source, target parameter/flag and new rules.

@algernon algernon merged commit 317d2af into hylang:master Oct 16, 2018
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