ArkScript-lang / ArkScript-lang/Ark
Unexpected module resolution
- Ngôn ngữ chính
- C++
- Star
- 728
- Fork
- 54
- Merge trung bình
- 4 giờ 8 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
### What happened?
```
(import std.Prelude)
(import std.List:*)
(print (max [1 2]))
```
```
(import std.Prelude)
(import std.List :max)
(print (max [1 2]))
```
In both these examples, I would expect `max` to be `list:max`, but instead it's `math:max`. I find that confusing, because `math:max` is not defined nor imported without the prefix in either module.
Both examples work as I'd expect (`max` resolving to `math:max`--EDIT: `list:max`, sorry!) if the order of imports is reversed.
### What ArkScript version are you seeing the problem on?
4.7.2
### Operating System
Linux
### Compiler used
None
### Compiler version used
_No response_
### Relevant code & log output
```shell
ArityError: When calling `(math:max [1 2])', received 1 argument, but expected 2: `(math:max _a _b)'
At IP: 597, PP: 0, SP: 3
exit status 1
```
### Documentation
- [x] I have read existing related documentation before submitting this report
- [x] I have searched for an existing issue before posting
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách chạy cả hai ví dụ import trên ArkScript 4.7.2 và theo dõi cách thứ tự import phân giải các tên không đủ điều kiện. So sánh việc phân giải `max` với `list:max` được import rõ ràng và `math:max` đủ điều kiện. Hoàn thành khi cả hai ví dụ đều phân giải `max` thành `list:max` bất kể thứ tự import.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- compilers
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 65/100