Re: [elixir-core:7220] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread José Valim
By integrating into the language, I mean in a way that it would yield large benefits only if made part of the language. The proposed solution and Decimal yield almost no benefits if part of Elixir compared to as a package, besides reachability. Also, the current proposal for coerce doesn't handle

Re: [elixir-core:7220] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread Wiebe-Marten Wijnja
Hello Jose, I completely understand where you are coming from. The main reason to add this to the core language is to standardize the return format of comparison functions. I believe this to be a very important idea. *Upcasting* as in the case of Decimals can be supported using the coercion-m

Re: [elixir-core:7218] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread José Valim
Hi Wiebe-Marten Wijnja, Thanks for the well-written proposal. I am afraid my opinion has not changed much from the first time around. The proposed solution would not support the "downcasting" done in `Date.compare`. `Decimal` may also want to perform casting as well. And while I understand why i

Re: [elixir-core:7218] [Proposal] Sorted Map and Sorted Set

2017-06-16 Thread Wiebe-Marten Wijnja
The 'indexed data structure' that is often used now in many projects is the built-in (Hash)Map that the newer versions of Erlang/OTP provide. The keys of a map kan be seen as a poor-man's pointers if you want to have (amortized) constant field access and update behaviour data structure. This is

Re: [elixir-core:7216] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread Parker Selbert
I'm strongly in favor of the proposal, it is an ideal use of protocols (and we aren't facing a non-BIF penalty). — Parker On Fri, Jun 16, 2017, at 03:51 PM, OvermindDL1 wrote: > Sounds like precisely what is needed. I'm all for it! > > > On Friday, June 16, 2017 at 2:16:59 PM UTC-6, Wiebe-Marte

Re: [elixir-core:7216] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread OvermindDL1
Sounds like precisely what is needed. I'm all for it! On Friday, June 16, 2017 at 2:16:59 PM UTC-6, Wiebe-Marten Wijnja wrote: > > Going back to the core of this issue, I'd like for there to be a simple > function `compare` with an accompanied Protocol, which ensures that the > comparison retu

Re: [elixir-core:7215] Re: Kernel.compare/2 and Comparable protocol

2017-06-16 Thread Wiebe-Marten Wijnja
After looking through the source of Elixir's `Enum` module and Erlang's `:lists` module, I now know that `:lists.sort` is implemented in plain Erlang, which means that it would also be possible to write multiple versions in Elixir (Most notably, both an low-to-high and high-to-low version). `En

Re: [elixir-core:7214] Proposal to add a mix integration with Fossil SCM

2017-06-16 Thread Eli Bierman
Hi Jose, Thank you so much for that information, that's so helpful! I think I'll do it exactly like you laid out. :) Eli On Friday, June 16, 2017 at 2:12:44 AM UTC-4, José Valim wrote: > > We don't plan to support other SCMs in Mix itself but you should be able > to augment Mix using Mix.SCM.

Re: [elixir-core:7212] assert_raise with bad message/1 implementation

2017-06-16 Thread Michał Muskała
Great, I'll work on this. Michał. On 16 Jun 2017, 15:13 +0200, José Valim , wrote: > "error_module.message(error)" sounds good, yes! > > > > José Valim > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > > On Fri, Jun 16, 2017 at 3:08 PM, Michał Muskała wrote: > > > I

Re: [elixir-core:7211] assert_raise with bad message/1 implementation

2017-06-16 Thread José Valim
"error_module.message(error)" sounds good, yes! *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Fri, Jun 16, 2017 at 3:08 PM, Michał Muskała wrote: > I don't think running Exception.message will cut it, since it will output > a string that the message/1 imp

Re: [elixir-core:7210] assert_raise with bad message/1 implementation

2017-06-16 Thread Michał Muskała
I don't think running Exception.message will cut it, since it will output a string that the message/1 implementation failed. Ideally, I wish the test would fail in that case. One solution would be to call error_module.message(error) manually, but this would mean ex_unit needs to replicate logic

Re: [elixir-core:7209] assert_raise with bad message/1 implementation

2017-06-16 Thread José Valim
Great catch. Yes, let's always invoke Exception.message on it, even if you don't match on it. *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Fri, Jun 16, 2017 at 2:54 PM, Michał Muskała wrote: > Hello everybody, > > Right now, when using assert_raise/2 (wi

[elixir-core:7208] assert_raise with bad message/1 implementation

2017-06-16 Thread Michał Muskała
Hello everybody, Right now, when using assert_raise/2 (without passing the message) the test succeeds even if the exception itself has bad implementation of the message/1 function and raises. I propose that assert_raise should fail whenever such a broken exception implementation is encountered