Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Has it been discussed to use dot relative path notation like in python's import?

55 views
Skip to first unread message

Brandon Gillespie

unread,
Nov 21, 2024, 1:59:53 PM11/21/24
to elixir-l...@googlegroups.com

So in elixir. From the module "Some.Module.Part"

Synonymous reference to 'current':

   import __MODULE__.More
   import .More
   import Some.Module.Part.More

Similarly, walking up the tree:

   import ..Another.Part
   import Some.Module.Another.Part


Ben Wilson

unread,
Nov 21, 2024, 3:25:08 PM11/21/24
to elixir-lang-core
I think a challenge here is that we're creating entirely new syntax. There isn't any support in the language today for `.` or `..` as leading characters, and I don't know that on its own this scenario is so common as to warrant entirely new syntax. In particular `..Another` I think is just generally less good than `Some.Module.Another.Part`, the extra characters aren't onerous to write and they improve readability because I don't need to look elsewhere to compute the module being imported.
Reply all
Reply to author
Forward
0 new messages