>
> 1. 2 space indent.

2. Nothing is on equal spacing with "g."


Cool. Although I prefer to start behind V() (at least 5 spaces in the
second line), UNLESS I have a mid-traversal V().

3. Barriers form line breaks.


Not cool. Long lines form line breaks. Sometimes I make it depend on the
steps I'm using, but the types of steps usually don't play a role.

4. by()-modulators form indented "paragraphs."


Nah, kinda don't like your style. I will show my variant at the end of that
message.

5. Standard filters.maps.flatmaps are single line until it gets unwieldy.


Again, the line length is all that really matters.

Here's my variant:

g.V().out("knows").out("attended").
      group().by("state").by().
        select("Vermont").unfold().
      in("attended").has("gpa").

  V().foo().bar().whatever().

      order().by("age",decr).
              by("gpa",incr).

      limit(10).values("name").


Besides that, I think that choose() is kinda special:

.choose(condition(), then().do().this(),
                     else().do().that())

Cheers,
Daniel


On Fri, Mar 4, 2016 at 3:39 PM, Marko Rodriguez <okramma...@gmail.com>
wrote:

> Hello,
>
> I'm futzing with our docs and noticed that the authors have different
> indentation styles for multi-line Gremlin traversals.
>
> I think we should converge on a similar style? ………
>
> And guess what, I think my style is the best.
>
> g.V().out("knows").out("attended").     // <1>
>   group().by("state").by()              // <2>
>      select("Vermont").unfold()         // <3>
>   in("attended").has("gpa")             // <4>
>   order()                               // <5>
>     by("age",decr).                     // <6>
>     by("gpa",incr).
>   limit(10).values("name")              // <7>
>
>
> Key features:
>
> 1. A bunch of in().outs().filters().etc. on a single line until it gets
> too long.
> 2. If you bust a barrier (reducer, aggregator, etc.), new line.
> 3. When a next line component is an "add on" to the previous line
> component, 2 space indent.
> - that select() is "almost like" a by().
> - unfold() is a dirty sucky you just tack on the end and don't make it too
> prominent as its just data formatting.
> 4. Back to a series of in().outs().etc., new line.
> 5. Another barrier -- new line.
> 6. If there is only one by()-modulator (or a series of short ones), keep
> it on one line. If its complex, each by() is a line.
> 7. Back to a series outs().filters().maps().etc.
>
> In summary,
>
> 1. 2 space indent.
> 2. Nothing is on equal spacing with "g."
> 3. Barriers form line breaks.
> 4. by()-modulators form indented "paragraphs."
> 5. Standard filters.maps.flatmaps are single line until it gets unwieldy.
>
> Thoughts?,
> Marko.
>
> http://markorodriguez.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gremlin-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gremlin-users/55E7B211-2B1B-4FDE-BC61-1C7A90428ECC%40gmail.com
> <https://groups.google.com/d/msgid/gremlin-users/55E7B211-2B1B-4FDE-BC61-1C7A90428ECC%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

Reply via email to