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

A library named `rename` cannot be imported, and any library cannot define `rename` #773

Closed
mnieper opened this Issue Jul 1, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@mnieper

mnieper commented Jul 1, 2016

The following two issues (tested in R7RS mode with version 0.99) may be related:

  • (import (rename)) gives:
Error: unhandled condition:
Compound condition has these components: 
#<record &who>
    who : rename
#<record &message>
    message : "Invalid form"
#<record &syntax>
    form : (rename)
    subform : #f

As soon as rename is defined at the REPL, the import works.

  • rename cannot be defined in library bodies. For example, (define rename 'a) in a library body gives:
Error: unhandled condition:
Compound condition has these components: 
#<record &who>
    who : define
#<record &message>
    message : "Redefinition of identifier in body"
#<record &syntax>
    form : (define rename 'a)
    subform : rename
@WillClinger

This comment has been minimized.

Show comment
Hide comment
@WillClinger

WillClinger Jul 1, 2016

Member

The first issue is an unfortunate consequence of hygiene: rename has a specific meaning within import forms that is incompatible with its use as a library name. Redefining rename at the REPL removes its usual meaning, making it available as a library name.

The second issue is a consequence of forbidding redefinitions of imported identifiers within library bodies, which are unlike top-level programs and REPLs in that respect. Perhaps that prohibition should be weakened, which is why I am leaving this issue open without assigning it a milestone.

Member

WillClinger commented Jul 1, 2016

The first issue is an unfortunate consequence of hygiene: rename has a specific meaning within import forms that is incompatible with its use as a library name. Redefining rename at the REPL removes its usual meaning, making it available as a library name.

The second issue is a consequence of forbidding redefinitions of imported identifiers within library bodies, which are unlike top-level programs and REPLs in that respect. Perhaps that prohibition should be weakened, which is why I am leaving this issue open without assigning it a milestone.

@mnieper

This comment has been minimized.

Show comment
Hide comment
@mnieper

mnieper Jul 1, 2016

Shouldn't this be marked as a bug (or as a deviation from the R7RS)? The identifier rename should not be bound by default in a library body.

mnieper commented Jul 1, 2016

Shouldn't this be marked as a bug (or as a deviation from the R7RS)? The identifier rename should not be bound by default in a library body.

@WillClinger WillClinger added this to the Larceny 1.3 milestone Jul 1, 2016

@WillClinger WillClinger self-assigned this Jul 1, 2016

@WillClinger

This comment has been minimized.

Show comment
Hide comment
@WillClinger

WillClinger Jul 1, 2016

Member

Yes, the first issue is a bug. The components of library names are symbols or exact non-negative integers, and should have nothing to do with the denotation of the identifier rename that's used when matching import sets or exports. The components of library names should be treated the same as field names in records.

Member

WillClinger commented Jul 1, 2016

Yes, the first issue is a bug. The components of library names are symbols or exact non-negative integers, and should have nothing to do with the denotation of the identifier rename that's used when matching import sets or exports. The components of library names should be treated the same as field names in records.

@WillClinger

This comment has been minimized.

Show comment
Hide comment
@WillClinger

WillClinger Jul 1, 2017

Member

Fixed by changeset 582c608

Member

WillClinger commented Jul 1, 2017

Fixed by changeset 582c608

@WillClinger WillClinger closed this Jul 1, 2017

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