Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: formatting of tables relies on fixed-width fonts #14234

Open
fgergo opened this issue Feb 4, 2016 · 9 comments
Open

spec: formatting of tables relies on fixed-width fonts #14234

fgergo opened this issue Feb 4, 2016 · 9 comments
Milestone

Comments

@fgergo
Copy link

fgergo commented Feb 4, 2016

On https://golang.org/ref/spec if you search for "array or slice" the table is not aligned as a table. I can't tell from this paragraph which is the 1st or the 2nd value in a range expression for different types.

(https://golang.org/doc/effective_go.html#for is clear on the range expression, though it's not the spec.)

@ianlancetaylor ianlancetaylor changed the title language spec about range expression on golang.org spec: bad formatting of range expression on golang.org Feb 4, 2016
@mdempsky
Copy link
Member

mdempsky commented Feb 4, 2016

Can you elaborate on what trouble you're having? It looks adequately table-aligned in my browser.

I believe the intended way to interpret that table is the line:

Range expression                          1st value          2nd value

array or slice  a  [n]E, *[n]E, or []E    index    i  int    a[i]       E
  • The "Range expression" column's cell is "array or slice; a; [n]E, *[n]E, or []E".
  • The "1st value" column's cell is "index; i; int".
  • The "2nd value" column's cell is "a[i]; E".

Then the way to understand that is for a for-based range loop like

for i, x := v { ... }

where v is of types [n]E, *[n]E, or []E, then the range values produced for i and x (respectively) will be an int-typed index and its corresponding E-typed element v[i].

@ianlancetaylor
Copy link
Contributor

CC @griesemer

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Feb 4, 2016
@fgergo
Copy link
Author

fgergo commented Feb 4, 2016

Attached what I see on win7, latest chrome:
range

@bradfitz
Copy link
Contributor

bradfitz commented Feb 4, 2016

Do you have some Chrome extension modifying your content? Or did you override the browser's monospace to be a proportional font?

@fgergo
Copy link
Author

fgergo commented Feb 4, 2016

Sorry about that! I should have known better: it's highly improbable that the spec is not flawless on golang.org...
I definitely set a wrong font somewhere.

@fgergo fgergo closed this as completed Feb 4, 2016
@mdempsky mdempsky changed the title spec: bad formatting of range expression on golang.org spec: formatting of tables relies on fixed-width fonts Feb 4, 2016
@mdempsky mdempsky reopened this Feb 4, 2016
@mdempsky
Copy link
Member

mdempsky commented Feb 4, 2016

Reopening just in case this is worth discussing further. The Go spec is maintained in HTML (not Godoc), so we could reasonably use actual <table> tags, etc. to make it more accessible to readers with less common setups (e.g., custom font settings, screen readers). Thoughts?

@fgergo
Copy link
Author

fgergo commented Feb 4, 2016

(you most probably asked only the core team, though in case not: I - as a non-representative, acme user - never align with spaces.)

@robpike
Copy link
Contributor

robpike commented Feb 5, 2016

I agree that this should be formatted as an HTML table. I also think this is very low priority.

@griesemer griesemer self-assigned this Feb 5, 2016
@fgergo
Copy link
Author

fgergo commented Feb 6, 2016

  • attached noborder.html.txt maybe this helps
  • I could only find the following sections maybe worth considering changing:
    Length and capacity
    Making slices, maps and channels
    Appending to and copying slices
  • I can do the copy paste for these 3 as well, if you want me to do it

noborder.html.txt

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

No branches or pull requests

6 participants