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

unexpected behavior with module names #8324

Closed
vicuna opened this issue Oct 16, 2003 · 2 comments
Closed

unexpected behavior with module names #8324

vicuna opened this issue Oct 16, 2003 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 16, 2003

Original bug ID: 1880
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Mikhail Zabelin
Version: OCaml 3.07 native Win32 port (MinGW)
OS: Windows 2000
Submission from: www-proxy.ioffe.rssi.ru (194.85.224.35)

source file f.ml:

module M =
struct
type x = {y: int}
let z = {y = 1}
end

let a = M.z.M.y (unexpected too)
let b = M.z.y

compile:

ocamlc f.ml
File "f.ml", line 8, characters 8-13:
Unbound record field label y


@vicuna
Copy link
Author

vicuna commented Oct 21, 2003

Comment author: administrator

source file f.ml:

module M =
struct
type x = {y: int}
let z = {y = 1}
end

let a = M.z.M.y (unexpected too)
let b = M.z.y

compile:

ocamlc f.ml
File "f.ml", line 8, characters 8-13:
Unbound record field label y

This is normal behavior: record label names are qualified by module
names like any other kind of names in the language. Thus, unless
you're in the scope of "open M", the label of type M.x is named M.y,
and projecting it out of an expression e is written "e.M.y".

I agree this isn't terribly pretty, but it's consistent with the rest
of the design.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Oct 21, 2003

Comment author: administrator

Normal behavior.

@vicuna vicuna closed this as completed Oct 21, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant