I definitely wouldn't call this a severe limitation, but it would be a
nice-to-have for readability. That said, I haven't actually run into any
cases where I would've used the shorthand syntax - as José mentioned in his
original reply, the vast majority of the time, structs have functions that
go with them, or at the very least, typespecs.

I do think it's possible for there to be cases where the shorthand syntax
would be used, but I have to say that I haven't seen that in the wild, or
in my own projects yet, so I can't say the need is particularly dire to
have this in the standard library. It's easy to implement this as a macro
in your own projects if it's a common need though. I think a real-world use
case which demonstrates the value would go a long way towards making your
case.

Paul


On Tue, Dec 27, 2016 at 2:33 PM, Akio Burns <[email protected]> wrote:

> Has there been any further consideration on this topic? Structs are great,
> but they feel severely limited without the ability to easily and cleanly
> define arbitrarily named structs.
>
>
> On Wednesday, March 19, 2014 at 5:43:45 PM UTC-4, José Valim wrote:
>>
>> That won't be the case for now. Structs are different than records. Cases
>> where you define a module simply to define a struct should be more
>> uncommon, I expect it to rather have struct-related functions the majority
>> of the time.
>>
>> So having only defstruct/1 will help send this message across. After
>> v0.13 is out and we are more familiar with structs, we can re-evaluate the
>> shortcut syntax again.
>>
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> Skype: jv.ptec
>> Founder and Lead Developer
>>
>>
>> On Wed, Mar 19, 2014 at 10:20 PM, Dave Thomas <[email protected]> wrote:
>>
>>> Would there be any support for extending defstruct so that
>>>
>>> defstruct Person, name: "", age: 21
>>>
>>> was a shortcut for
>>>
>>> defmodule Person
>>>   defstruct name: "", age: 21
>>> 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 [email protected].
>>> 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/716bde83-ad19-46ad-896f-
> 90be5493c035%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/716bde83-ad19-46ad-896f-90be5493c035%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/CAK%3D%2B-Tto7GDLvgY1LBX_T_xJc6MBBScX-z8_ximv_VpXaoykFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to