Skip to content

Error when using the name "unit" for something in a class #994

Open
@hashimmm

Description

@hashimmm

What version of Racket are you using?

Racket CS 7.9

What program did you run?

 #lang typed/racket
 
 (define foo%
   (class object%
     (init [unit : String])
     (super-new)
     (: _unit String)
     (define _unit unit)
     (: get-unit (-> String))
     (define/public (get-unit) _unit)))

 (new foo% [unit "kg"])

What should have happened?

The above should work the same as this:

 #lang racket
 
 (define foo%
   (class object%
     (init unit)
     (super-new)
     (define _unit unit)
     (define/public (get-unit) _unit)))
 
 (new foo% [unit "kg"])

If you got an error message, please include it here.

unit: bad syntax in: unit

More info:

Renaming unit to bar works in the typed/racket version.
Switching to typed/racket/base also works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions