Re: [elixir-core:7908] Re: [Proposal] Kernel.is_module?/1

2018-02-26 Thread José Valim
> I've found that in practice both `Code.ensure_loaded` and `Code.ensure_compiled?` are both extremely slow in practice. Yes, modules are atoms and the only way to know if an atom is actually a module during development is if you check if there is a .beam file on disk. If you want a quick check

[elixir-core:7913] Re: [Proposal] Kernel.is_module?/1

2018-02-26 Thread OvermindDL1
For note, for a quick-check if a module exists I just do something like: ```elixir ╰─➤ iex Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false] Interactive Elixir (1.6.1) - press Ctrl+C to exit (type h() ENTER for help) iex(1)>

Re: [elixir-core:7914] Introduce Sum Types

2018-02-26 Thread Louis Pilfold
That would be the library I started writing that I was looking for an alternative to finishing :D Guess I should finish it! On Mon, 26 Feb 2018, 22:02 OvermindDL1, wrote: > So something more like https://github.com/lpil/sum or so (undocumented, > but it looks right, it's

Re: [elixir-core:7913] Re: [Proposal] Kernel.is_module?/1

2018-02-26 Thread Thomas Cioppettini
OvermindDL1, `function_exported?` was the second method I tried, but the caveat of it needing to be loaded in memory causes too many issues IMO. That is why I settled on the current version I linked to above, which is a more direct variant of what you are suggesting. On Mon, Feb 26, 2018 at 5:13

Re: [elixir-core:7912] Introduce Sum Types

2018-02-26 Thread OvermindDL1
So something more like https://github.com/lpil/sum or so (undocumented, but it looks right, it's the first thing I found via a github search). There is one specific one I'm thinking of but can't for the life of me remember it's name... I wish hex.pm had the ability to search module and

Re: [elixir-core:7916] Introduce Sum Types

2018-02-26 Thread OvermindDL1
Lol! I thought that name looked familiar. ^.^ You should, I know there are a couple of 'incomplete' implementations around (though that one that I cannot remember the name of was the closest...). :-) On Monday, February 26, 2018 at 3:52:32 PM UTC-7, Louis Pilfold wrote: > > That would be

[elixir-core:7910] Enhancement request: parse character offsets for AST node

2018-02-26 Thread Serge Smetana
Hi, I would like Elixir AST nodes to include begin and end parse character offsets. This would make it easier to write refactoring tools that modify parts of Elixir source files. Usecase: We have a library https://github.com/assert-value/assert_value_elixir that is able to create and update

Re: [elixir-core:7910] Enhancement request: parse character offsets for AST node

2018-02-26 Thread Louis Pilfold
Hi there Given we have the formatter now I would be tempted to avoid editing strings and instead update the AST of the file, render that to a string, format it and write it back to the file. Would be more reliable. Cheers, Louis On Mon, 26 Feb 2018, 12:11 Serge Smetana,