On Wednesday, October 19, 2016 at 10:58:17 AM UTC-6, Peter Damoc wrote:
>
> On Wed, Oct 19, 2016 at 3:02 PM, John Orford <john....@gmail.com 
> <javascript:>> wrote:
>
>> Commas beginning lines etc.
>>
>> Perhaps not idiomatic in Python or JS, but new good ideas rarely are : )
>>
>>
> I think I've answered too quickly in the previous reply. 
>
> Commas beginning lines looks weird to a lot of people glancing at elm. 
> We got used to them and, as with status quo in general, one can find 
> reasons to keep it. 
>
> I would much rather have the compiler accept trailing comas and elm-format 
> inserting them automatically when spreading a list/record on multiple lines.
>

That is what I'd prefer as well.  An example, all of this is valid OCaml 
code for a record:
```ocaml
type myRecord = {
  i : int;
  s : string
}

type myRecord = {
  i : int;
  s : string;
}

type myRecord =
{
  i : int;
  s : string
}

type myRecord =
{ i : int;
  s : string
}

type myRecord =
{ i : int;
  s : string }

type myRecord =
{ i : int
; s : string
}
```
Though as you note, no pre-;'s are allowed, but trailing are.  For 
Variants/Unions:
```ocaml
type myUnion = Something | AnotherThing

type myUnion =
  Something | AnotherThing

type myUnion =
    Something
  | AnotherThing

type myUnion
  = Something
  | AnotherThing

type myUnion =
  | Something
  | AnotherThing
```
The | can have a prefix one, but not a trailing one.  Personally I always 
use the bottom style unless I am just wrapping up a type into a new type to 
make sure I do not mis-use it, like by doing:
```ocaml
type systemID = SystemID of string
```

However, elm is trying to minimize the possible ways to represent 
something, if you can already do something one way then do not add in 
another way (I'm still not a fan of `.field` style record accessors, maybe 
a Lens or so to be able to get/set/update, but eh), and early/trailing 
things are such superfluous things technically.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to