Forgive me if I am missing something obvious, but I don't quite understand how 
the underscores are making your tests fail. The compiler removes them. It is 
only syntactic sugar for us humans who are bad at parsing long sequences of 
numbers. Would you be able to provide an example of how these are making your 
tests fail?

iex(1)> 100_000_002 == 100000002
true
iex(2)> 100_000_002 = 100000002
100000002
iex(3)> quote do 100_000_002 end
100000002

# This test passes
test "underscores in numbers" do

  assert 100_000_002 = 100000002

end

Justin

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On 27 April 2018 2:01 PM, Onorio Catenacci <catena...@gmail.com> wrote:

> On Saturday, April 21, 2018 at 4:06:45 AM UTC-4, Allen Wyma wrote:
>
>> First of all, I'd like to say thanks so much for the elixir formatter. I do 
>> like nearly all of the defaults. There's one place that I would like to 
>> change:
>>
>> formatting of numbers.
>>
>> I'd like to be able to turn off the auto formatting of numbers to add in 
>> underscores after every third number.
>>
>> Reason:
>> I do have some test data in my elixir files that I use to check information 
>> and when I search for certain test data by ID, which is a long number, it 
>> won't be found cause of the underscores added to the number.
>>
>> I can see this being useful if you're working with currency, or numbers with 
>> some meaning of counting; it does make the numbers easier to read, but if 
>> you're reading like an ID, then it becomes a big difficult to understand.
>>
>> %{ "specialId" => 100000002 } # => %{ "specialId" => 100_000_002 }
>
> I wonder (just thinking out loud here) if we could leverage a type spec on 
> the number to tell the formatter to leave the number as is?  I mean it seems 
> as if your issue is that it's treating what's essentially a long string 
> composed of only digits as a number rather than a string.
>
> I agree with Louis' point.  A formatter that allows for a lot of 
> customization rapidly loses the value of enforcing common conventions on all 
> code that's run through it.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> [https://groups.google.com/d/msgid/elixir-lang-core/d2eeb293-61b9-4139-84d7-49a7871522ef%40googlegroups.com](https://groups.google.com/d/msgid/elixir-lang-core/d2eeb293-61b9-4139-84d7-49a7871522ef%40googlegroups.com?utm_medium=email&utm_source=footer).
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/siNPFCNkfrABhDqMwHw5_G5BxiyPsafcXpDqv0g457e7SF5TdpZr71PgeaezlV7T_OQNUYPDlC7Z8pa_kTbGLdwk9e_3L6hhJ-sBHv_CqVw%3D%40protonmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to