ubill
Iex Shell: How to delete/overwrite an alias in the shell?
I have asked this question on Slack, no solutions from there, so putting it up here.
The situation is,
Let’s say I’ve typed in the iex shell alias Asdf.Qwer, but actually what I need now is simply Qwer , I have no way to clear Asdf.Qwer because alias Qwer just again gives me Asdf.Qwer . So am I forever stuck with that? Or is there a way to reset/delete aliases
In other words, Qwer is now forever referring to Asdf.Qwer because of my mistype, and there is no way to delete/say that I don’t want this anymore. Or is there?
(P.S. an unrelated question, is the source code of Elixir Forum available as open source somewhere? It’s a great interface and I admire it very much.)
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










First 10 of 11 Posts
bobbypriambodo
Is closing and reopening the shell (or via
respawn) not a viable solution? (basically it will clear all bound variables and aliases in the shell.)ubill
Thanks, but I don’t want to clear all variable bindings I have currently declared so far and am working on something. (Otherwise just ctrl-C twice out from the shell and coming in back again would have been done.)
Reason I’m asking is to see whether this possibility is already there, just that I don’t know the way how-to.
And Erlang’s shell did have an f() / f(variable) function that cleared the binding (for all/a variable), so I just want to find out if there’s something along the same idea in Iex.
ubill
It may be the aliases are stored in some (state-holding) variable or struct somewhere, like in Python-world, ‘sys.modules’ or such. But I don’t know.
muhifauzan
Since you use alias which is
alias Asdf.Qwer, you can refer to the originalQwerusingElixir. Call it like thisElixir.Qwer.bobbypriambodo
Hmm, funny, it seems that you can overwrite alias in some cases and can’t in other cases. I’ve played with this:
josevalim
This is a bug. Can you please file a bug report?
muhifauzan
Yeah, I can confirm this. I also just playing around with alias in IEx with the same result as yours.
bobbypriambodo
Will do!
bobbypriambodo
https://github.com/elixir-lang/elixir/issues/5587
ubill
Thanks guys. Just saw the replies as I’ve been away for the holidays.
@bobbypriambodo’s tests and attempts did make sense but ultimately discovered that it couldn’t behave as expected or intended; I tried and confirmed that too.
So logging as a bug does appear to make the most sense. Thanks again everybody!!