> On 25 May 2016, at 18:46, José Valim <jose.va...@plataformatec.com.br> wrote:
> 
> Also, it’s a stretch, but it’s possible that a sloppy programmer separates 
> these expressions, say by inserting a multiline comment, a typespec, or even 
> something completely unrelated. Then it becomes harder to spot the complete 
> specification of the struct.
> 
> Sloppy programmers will break all kinds of code. I generally really dislike 
> the sloppy programmer argument. Do we really want to guide our decisions 
> based on programmers that are sloppy?


All other things being equal or very similar, I think the interface which 
prevents sloppiness is better. 


>  
> Say I want to move the struct to another module, I have to pay attention to 
> move all three expressions (which might be separated by some other not 
> necessarily struct related stuff). Or say in my macro which defines a struct, 
> I want to prevent some option (e.g. require).
> 
> If you are moving code around, you always need to pay attention. :) What if 
> you are defining the struct like this:
> 
> if some_condition? do
>   ... some code ...
>   defstruct
> else
>   defstruct
> end
> 
> If you get the first defstruct and ignore the rest... it will be wrong.

It will break on compile, hinting me that I didn’t move the complete code. Yes, 
I need to pay attention, but compiler has my back.

I understand what you’re saying, and I agree my point is moot, but I still 
think that a single “atomic” expression is better than three which semantically 
boil down to one. 
The former approach means I have to know only Elixir syntax to understand what 
constitutes a single expression.
The latter approach means I have to know the semantics of @derive, @require and 
defstruct/defexception/schema, to know that these things tie together. 

-- 
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/997F23AF-3CCC-418B-9F69-276D3E83917A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to