phgrey

phgrey

Global pseudonym for module

have module A.B. And another module A.C is the same. do not want to copy. is there a way to create GLOBAL pseudonym? smth like alias A.B as: A.C but not inside the module, site-wide.
the reason: i have some API as a requirement (incl module names) and already have a module with functional needed.

UPD: and yeah, actually modules are surface components, so i’ve failed when trying to use third module with all the stuff inside __using__ macro(((

erlang 25.2
elixir 1.14.1

thanks in advice!

First Post!

juhalehtonen

juhalehtonen

If I got your question right, you are required to create a new module that follows the same public API as some other module that you already have. You also don’t want to copy code over from the existing module to the new one.

Have you looked at using defdelegate/2 (docs) to achieve what you’re looking for?

Last Post!

phgrey

phgrey

i want to create a module with new name (it’s requirement) but with all the functionality of the existing module (also internal) without code duplicating

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement