mikesax

mikesax

I was writing code that included a function I would call later (so it wasn’t called yet). I got a warning, and I thought I could put an underscore before the function name, the way it works for variables, but that didn’t work. While writing @compile :nowarn_unused_functions isn’t a terrible hardship, it would be nice to simply write:

def _unused_function do
end

Showing Posts 1 to 3

LostKobrakai

LostKobrakai

I’m not sure I see the use in this. Not using a variable have legitimate reasons to exist in elixir programs. E.g. a certain parameter might only be used some parts of the branched execution of multiple function heads.

An unused private function has no such reason to exist.

Also it’s just a warning, which can easily be ignored until a chunk of code is completed. E.g. zig actually refuses to compile if you have e.g. unused variables.

mikesax

mikesax OP

Yes, while I’m not familiar with Zig I agree that (besides unused parameters) for variables there is other value such as documentation/readability. The only use case that comes to mind is the one I was running into: telling the compiler “I know this is unused” while writing unfinished code (and I expected it to work consistently). I often have an urge to fix warnings immediately, so it’s distracting.

sodapopcan

sodapopcan

Me too, but I just comment them out. Best solved with your editor, I’d say! Depending on your editor, you could look for something that gives you “comment out function” with a simple key combo.

— All posts loaded —

Where Next? Top

Trending in Proposals: Ideas Top

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
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
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews