Hi Gasper,

You might be interested in `defun` macro provided by croma:
https://github.com/skirino/croma/
Hope this helps!

Shunsuke Kirino


2017-09-30 21:50 GMT+09:00 <[email protected]>:

> Hi Jose!
>
> Ok, just to speed up my development - where in Elixir source tree can I
> find type/spec parser? Because it definitely parses them and compains about
> callbacks signature mismatch :)
>
> /Gaspar
>
> On Saturday, September 30, 2017 at 2:46:04 PM UTC+3, José Valim wrote:
>>
>> No, they have to "use something". Being unable to have a magic command
>> that modifies all modules globally is what helps meta-programming in Elixir
>> be a bit sane.
>>
>>
>>
>> *José Valimwww.plataformatec.com.br
>> <http://www.plataformatec.com.br/>Founder and Director of R&D*
>>
>> On Sat, Sep 30, 2017 at 1:42 PM, <[email protected]> wrote:
>>
>>>
>>>
>>> On Saturday, September 30, 2017 at 2:36:30 PM UTC+3, Louis Pilfold wrote:
>>>>
>>>> Heya
>>>>
>>>> You could write a library that does this rather than modifying Elixir.
>>>> It would be a cool project :)
>>>>
>>>> Cheers,
>>>> Louis
>>>>
>>>
>>> I wonder if I can redefine  'def' macro and inject it into every module
>>> without modifying module to have 'use Something' in them.
>>>
>>> /Gaspar
>>>
>>>
>>>
>>>
>>>>
>>>> On Fri, 29 Sep 2017, 18:06 , <[email protected]> wrote:
>>>>
>>>>> Hi all!
>>>>>
>>>>> I increasingly find myself writing more or less exactly same logic as
>>>>> in @type/@spec in body of the function to check incoming arguments.
>>>>>
>>>>> Would it be helpful if Elixir compiler could wrap function into assert
>>>>> check for incoming arguments and also result generated based on typespec?
>>>>>
>>>>> I think it would be very useful for
>>>>>
>>>>> - while running unit tests immediately see where components
>>>>> interaction breaks
>>>>> - keeping unit tests data in sync while developing - creates more
>>>>> crashes when some stub/test data does not comply with changed logic in
>>>>> function
>>>>> - running system and checking where it breaks the contracts between
>>>>> components in run-time/while debugging (dyalizer does a great job to
>>>>> extract information during static analysis phase, but runtime can provide
>>>>> more incorrect data :)
>>>>> - encourage writing more typespecs because benefits of doing so will
>>>>> be visible immediately and not when (occasionally) dyalizer will be run. 
>>>>> So
>>>>> make it type specification first class citizen that is not just for
>>>>> documenting code, but also to enforce constraints.
>>>>>
>>>>> I personally would also love to have possibility for extended typespec
>>>>> that would allow also specify relation between arguments too. Like
>>>>> assert(arg1 + arg2 > 0).
>>>>>
>>>>> It seems that it may be achieved mostly by rewriting def/defp macros
>>>>> and embedding asserts code generated from @spec around function body.
>>>>>
>>>>> This will slow down the execution of code and should be compiler
>>>>> option to turn it on/off for production/dev/testing environment separately
>>>>> with on setting in development/testing by default.
>>>>>
>>>>> What do you think?
>>>>>
>>>>> /Gaspar
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/elixir-lang-core/638bb1fe-
>>>>> 5276-49a3-9013-a784625226ea%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/638bb1fe-5276-49a3-9013-a784625226ea%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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/elixir-lang-core/0c977fbd-d5a9-4c74-8209-741b550ce43e%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/0c977fbd-d5a9-4c74-8209-741b550ce43e%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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/ddb36f63-0b6c-4d61-a7a3-
> bc6bba980b8e%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/ddb36f63-0b6c-4d61-a7a3-bc6bba980b8e%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CA%2BLpuvkVjLbY9nWRn-1AH2Y5ZouyB934DtfcD7ZsQME6CkmpLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to