| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
October 26, 2015 [Issue 15248] Function in current module is not allowed to overload imported function | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15248 Maxim Fomin <mxfomin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mxfomin@gmail.com Hardware|x86_64 |All OS|Linux |All Severity|enhancement |normal --- Comment #1 from Maxim Fomin <mxfomin@gmail.com> --- The hijack.html is rather rationale than formal spec (and thus can be interpreted in different ways), but in the beginning it contains: The first stab at fixing this problem in the D programming language was to add the rules: 1. by default functions can only overload against other functions in the same module 2. if a name is found in more than one scope, in order to use it it must be fully qualified I think round() is found in several scopes and thus must be fully qualifyed. AFAIK approx. a year ago semantic of overloading what changed but I cannot find any mention in the spec or in the changelog (one of the features is ability to hijack round() by placing import inside function). Also I remember some issues were filed with complains about new behavior but they were closed as invalid - even seasoned D users were unaware of new behavior. Definetely there is a spec problem. -- | ||||
October 27, 2015 [Issue 15248] Function in current module is not allowed to overload imported function | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15248 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thecybershadow@gmail.com --- Comment #2 from Vladimir Panteleev <thecybershadow@gmail.com> --- You can reintroduce std.math.round to the current module's overload set using an alias: alias round = std.math.round; -- | ||||
October 27, 2015 [Issue 15248] Function in current module is not allowed to overload imported function | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15248 --- Comment #3 from Shriramana Sharma <samjnaa@gmail.com> --- @Vladimir: Thanks, but I realize that workarounds exist. However if http://dlang.org/hijack.html is an accurate description of the hijacking prevention mechanism then the compiler (and the spec if necessary) should be fixed. -- | ||||
October 13, 2022 [Issue 15248] Function in current module is not allowed to overload imported function | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15248 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |INVALID --- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> --- https://dlang.org/articles/hijack.html#overload-sets correctly describes the mechanism. In your example, round is preferred so that any function that is introduced by std.math does not hijack the execution. Using the alias to introduce std.math.round is not a workaround but the de facto standard of merging overload sets. This is the described, correct behavior, therefore this bug report is not valid. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply