Re: [elixir-core:8371] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
> library and see what happens :) > > Cheers, > Louis > > On Wed, 7 Nov 2018 at 17:44 Sergiy Kukunin > wrote: > >> Thanks for the answers. Just want to note, that I don't want to invent >> type system such as in statically typed languages. I mean more

Re: [elixir-core:8372] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
at 9:15 PM Louis Pilfold wrote: > Hi Sergiy > > I'm afraid I don't follow. From what I understand of your proposal the > current defguard system meets your needs- what are you looking to add? > > Cheers, > Louis > > On Wed, 7 Nov 2018 at 18:38 Sergiy Kukunin > wrot

Re: [elixir-core:8369] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
>> like Ocaml for example? Elixir is bound to Erlang VM and will never provide >> any features like you're describing that are not supported by Erlang. And I >> don't think type-checking ever happens at runtime in any language. >> >> On Wednesday, November 7, 2018 at 12:0

Re: [elixir-core:8373] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
e to write something like defguard is_list_of_strings(x) match_type([String.t(), ...]) Again, I'm pretty new, and I know nothing about the implementation and where Elixir ends and Erlang starts, and how feasible it is. Just an idea =) On Wed, Nov 7, 2018 at 10:11 PM Sergiy Kukunin wrote: > Actually

Re: [elixir-core:8375] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
t; Another option would be to write a macro that prepends a type checking > statement to a function body, asserting that the arguements are of the > correct type. > > Cheers, > Louis > > On Wed, 7 Nov 2018, 22:41 Sergiy Kukunin, > wrote: > >> Found another problem: can't ex

[elixir-core:8366] Re: Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
I mistook, sorry: To avoid performance penalty we could enable the typespec runtime asserts only for development and testing environments On Wednesday, November 7, 2018 at 1:00:53 PM UTC+2, Sergiy Kukunin wrote: > > Hello there. This is my first message to the elixir group.

[elixir-core:8365] Runtime typespecs assertion

2018-11-07 Thread Sergiy Kukunin
Hello there. This is my first message to the elixir group. Thanks for the great language. While I'm writing my code, I want to make functions to be safer. It's bad practice if a function accepts unexpected input and pass it further, and it blows in a completely different part of a system. At