Skip to content

Import statement does not follow identifier equality rules #18476

Open
@Vladar4

Description

@Vladar4

The manual vaguely implies that module names should follow identifier equality rules (so, partial case-insensitivity and underscore is ignored).

A valid module name can only be a valid Nim identifier

https://nim-lang.org/docs/manual.html#modules
https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality

But it appears that import statements treat foobar, foo_bar, or fooBar as different modules.

Example

import foobar

import foo_bar

import fooBar

# with only `foobar.nim` file present all three cases should work identically.

Current Output

Error: cannot open file: foo_bar

Expected Output

Normal compilation conforming to identifier equality.

Possible Solution

If I am mistaken about the idea that import statement should follow identifier equality rules, it would be helpful if it was reflected in the manual. Otherwise there is a bug in the import statement.

Additional Information

Original discussion: Vladar4/sdl2_nim#35 (comment)

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
git hash: 3645f5fc7ae885e22cb52b9f865edf062cfb8e59

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions