Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

Specific associated types: Foo<Bar=Baz> or Foo<Bar = Baz>? #41

Open
chris-morgan opened this issue Jan 13, 2015 · 4 comments
Open

Specific associated types: Foo<Bar=Baz> or Foo<Bar = Baz>? #41

chris-morgan opened this issue Jan 13, 2015 · 4 comments

Comments

@chris-morgan
Copy link
Member

Two options:

  1. Foo<Bar=Baz>
  2. Foo<Bar = Baz>

I think the second is more consistent with what we’ve done in the past and prefer it myself, but the first appears at present to be considerably more common in the Rust repository. (Bear in mind—this note existing because I disagree with the actions taken, of course—that this expresses the opinions of a very few!)

Sample regular expressions to search with to find probable matches (PCRE needed, I used ag):

  1. (?<!type )(?<![:&$.])(?<![:={] )(?<!\blet )\b[A-Z][A-Za-z]+ = [A-Z<] (approximately 130 genuine matches)
  2. (?<!type )(?<![:&$.])(?<![:={] )(?<!\blet )\b[A-Z][A-Za-z]+=[A-Z<] (approximately two genuine matches)
@Gankra
Copy link

Gankra commented Jan 13, 2015

The first being common is largely a case of us being lazy, I think. The second style is more clearly consistent with all other guidelines. It just makes an already verbose syntax even more verbose, which makes me sad.

@hauleth
Copy link

hauleth commented Mar 6, 2015

Personally I prefer second option. Although it verbosity, it is more consistent and clear. Also clarity/verboseness ratio is good enough to consider it as a good practise.

@tbu-
Copy link

tbu- commented Apr 6, 2015

I'd prefer the first option here, similar to python's PEP 8. IMO it should be treated like keyword parameters.

@donsignore
Copy link

Wouldn't Foo <Bar=Baz> reflect the intention more semantically?

If i recall correctly keyword arguments in python are also meant to be bound closely without a space.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants