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

"Wrong file naming" compiler bug #3700

Closed
vicuna opened this issue Jun 23, 2005 · 1 comment
Closed

"Wrong file naming" compiler bug #3700

vicuna opened this issue Jun 23, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 23, 2005

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

Bug description

Full_Name: Brian Hulley
Version: 3.08.2
OS: Windows XP SP2
Submission from: dsl-80-44-75-116.access.as9105.com (80.44.75.116)

I have got two files, stringsource.ml and stringsource.mli (all lowercase).
However the compiler keeps complaining that:

"Wrong file naming: stringSource.cmi contains the compiled interface for
Stringsource"

In this message, the compiler has got the cases completely mixed up, because I
used "StringSource" as the module name and the files are stored on disk with all
lower case characters, so I can't figure out where the compiler is getting
"stringSource" from. I've tried everything: deleting the files from disk,
changing the name of the module from "StringSource" to "Stringsource" etc, but
nothing seems to work.

A bug report 2027 seems related, but that is marked as fixed (although the
report was related to Mac OS I think) Also there was a question on this issue on
a Yahoo group, but someone replied that it was fixed, but I assume this fix must
have been for a different operating system since it is certainly not fixed on
Windows XP.

I am compiling via:

ocamake *.mli *.ml

and the contents of the files are:

stringsource.mli:

module type STRINGSOURCE = sig
val getSource : string -> (int -> char option)
end;;

stringsource.ml:

module Stringsource:STRINGSOURCE = struct
let getSource (s:string) =
let len = String.length s in
function i ->
if (i < len) then Some s.[i] else None
end;;

Many thanks - I look forward to trying out this new language.

@vicuna
Copy link
Author

vicuna commented Jul 8, 2005

Comment author: administrator

I have got two files, stringsource.ml and stringsource.mli (all lowercase).
However the compiler keeps complaining that:

"Wrong file naming: stringSource.cmi contains the compiled interface for
Stringsource"

That means somewhere in your source you are using StringSource as
the name of the module that corresponds to your two files. You cannot
do that. The name of the module must be the same as the file names,
with an uppercase initial. Hence: Stringsource.

In this message, the compiler has got the cases completely mixed up, because
I
used "StringSource" as the module name and the files are stored on disk with
all
lower case characters, so I can't figure out where the compiler is getting
"stringSource" from.

It gets it by lowercasing the initial of the module name.

stringsource.mli:

module type STRINGSOURCE = sig
val getSource : string -> (int -> char option)
end;;

stringsource.ml:

module Stringsource:STRINGSOURCE = struct
let getSource (s:string) =
let len = String.length s in
function i ->
if (i < len) then Some s.[i] else None
end;;

As given, your files trigger this error, as expected:

File "stringsource.ml", line 1, characters 20-32:
Unbound module type STRINGSOURCE

Since stringsource.mli declares a module type named STRINGSOURCE,
you must define this module type in stringsource.ml (in this case,
by copying the definition from stringsource.mli).

-- Damien

@vicuna vicuna closed this as completed Jul 8, 2005
@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