Re: [elixir-core:8538] [Proposal] Show doctest source in ExUnit error messages

2019-03-13 Thread Rich Morin
> On Mar 13, 2019, at 1:32 AM, José Valim  
> wrote:
> 
> We can probably have the code show exactly that, no need for a new doctest 
> entry.

Although my example didn't make much of a case for it, in some cases it may be
useful to have both the original doctest code and the translated code.  If the
translation went awry, this could help the user ascertain what happened.

> I like this. Please open up an issue.

Done:
  Doctest error messages could display the actual doctest code #8889
  https://github.com/elixir-lang/elixir/issues/8889

-r

-- 
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/A43D5A70-262D-4994-9B68-D12ACF03D597%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:8537] [Proposal] Simplify @spec def and @spec defp for efficiency and maintenance purpose

2019-03-13 Thread Louis Pilfold
Hi

As Elixir has reached version 1 there's not going to be a major change of
syntax like this.

You could implement this as a macro in your own project though :)


use MyMacro

def add(x :: number(), y :: number()) :: number() do
  x + y
end


Cheers,
Louis

On Wed, 13 Mar 2019, 08:34 ,  wrote:

> Instead of doing this:
>
> defmodule LousyCalculator do
>   @spec add(number, number) :: {number, String.t}
>   def add(x, y), do: {x + y, "You need a calculator to do that?!"}
>
>   @spec multiply(number, number) :: {number, String.t}
>   def multiply(x, y), do: {x * y, "Jeez, come on!"}
> end
>
>
>
> How about this:
>
> defmodule LousyCalculator do
>
>   @specdef add(x number, y number) :: {number, String.t} do: {x + y, "You 
> need a calculator to do that?!"}
>   @specdef multiply(x number, y number) :: {number, String.t} do:   {x * y, 
> "Jeez, come on!"}
> end
>
> --
> 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/ac230011-82c2-4c44-8c4b-58fd163ec081%40googlegroups.com
> 
> .
> 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/CABu8xFACGGkm8GtEKQPxog4X4AEjkwUim_aXRWZMwQXJvdxEpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[elixir-core:8537] [Proposal] Simplify @spec def and @spec defp for efficiency and maintenance purpose

2019-03-13 Thread unifiedf
Instead of doing this:

defmodule LousyCalculator do
  @spec add(number, number) :: {number, String.t}
  def add(x, y), do: {x + y, "You need a calculator to do that?!"}

  @spec multiply(number, number) :: {number, String.t}
  def multiply(x, y), do: {x * y, "Jeez, come on!"}
end



How about this:

defmodule LousyCalculator do

  @specdef add(x number, y number) :: {number, String.t} do: {x + y, "You 
need a calculator to do that?!"}
  @specdef multiply(x number, y number) :: {number, String.t} do:   {x * y, 
"Jeez, come on!"}
end

-- 
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/ac230011-82c2-4c44-8c4b-58fd163ec081%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elixir-core:8535] [Proposal] Show doctest source in ExUnit error messages

2019-03-13 Thread José Valim
We can probably have the code show exactly that, no need for a new doctest
entry. I like this. Please open up an issue.
-- 


*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R

-- 
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/CAGnRm4%2BNZpSsDgnp80WRxdPaM0%2BTEGqko9Cpbzo-bdj%2B9x6ZXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.