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

Redefining hd and pattern matching #24

Closed
fehrenbach opened this issue Jan 27, 2016 · 3 comments · Fixed by #843
Closed

Redefining hd and pattern matching #24

fehrenbach opened this issue Jan 27, 2016 · 3 comments · Fixed by #843
Assignees
Labels

Comments

@fehrenbach
Copy link
Member

This test fails:

Case patterns (with redefined hd)
{ fun hd(_) { 1 } switch (['a']) { case [y] -> y }}
stdout : 'a' : Char

My best guess: pattern matching desugars to calls to hd and tl, but is not hygienic.

fehrenbach added a commit to fehrenbach/links that referenced this issue Jan 28, 2016
@slindley slindley added the bug label Jul 28, 2016
@slindley
Copy link
Contributor

You are correct.

fehrenbach added a commit to fehrenbach/links that referenced this issue Sep 2, 2016
fehrenbach added a commit that referenced this issue Sep 27, 2016
These are well-known issues:
- #23
- #24
- #25
@jamescheney
Copy link
Contributor

Now that we have a module system, perhaps we should desugar to List.hd and List.tl, where List is a built-in module that provides the standard definitions of these operators.

@jamescheney
Copy link
Contributor

Actually, this turns out to be trivial to fix, just by looking up the various functions in the initial environment rather than the current one passed in to the pattern compiler. (Another clunkier fix that also worked was to have special versions of hd and tl that had names that are impossible to write in Links source code.) See #843

@jamescheney jamescheney self-assigned this Jun 14, 2020
jamescheney added a commit that referenced this issue Jun 17, 2020
) (#843)

* hygienic references to library functions in pattern compilation

* removed commented out dead code
jamescheney added a commit that referenced this issue Jun 22, 2020
) (#843)

* hygienic references to library functions in pattern compilation

* removed commented out dead code
frank-emrich pushed a commit to frank-emrich/links that referenced this issue Sep 16, 2020
…inks-lang#24) (links-lang#843)

* hygienic references to library functions in pattern compilation

* removed commented out dead code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants