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

Proposal: Add options in editor to allow visually replace {} brackets with indentation only and vice versa #69967

Closed
2 of 4 tasks
Liebenfiels opened this issue Oct 21, 2024 · 8 comments
Labels
LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee Proposal
Milestone

Comments

@Liebenfiels
Copy link

Liebenfiels commented Oct 21, 2024

Go Programming Experience

Novice

Other Languages Experience

Python, BASIC- learning

Related Idea

  • Has this idea, or one like it, been proposed before?
  • Does this affect error handling?
  • Is this about generics?
  • Is this change backward compatible? Breaking the Go 1 compatibility guarantee is a large cost and requires a large benefit

Has this idea, or one like it, been proposed before?

NO

Does this affect error handling?

Should not as cosmetic visual fix only

Is this about generics?

Yes- about editor to match Python indentation

Proposal

I started learning programming last year... old school with '86 BASIC2 (GEM2 on 5.25" 360kb floppy) on 1986 8 MHz computer then 1991 QBASIC on 40 MHz PC386. Made QBASIC .exe functioning program and outcompeted Bing AI on math with both verions of programs.
1991 QBASIC had automatic formatting of text...
n=1 would give n = 1 when Enter was pressed and applied to all.

No modern Visual Code has it or Python IDLE shell can do it- we moved backwards 30 years.
BASIC syntax was clear, lots of good books (QBASIC by Example) teaching programming Foundation.
I am learning Python since April 2024- both Python and BASIC have best syntax, hence Python takes lead.
The Classes I don’t like- good it was dropped in GO.

The curly brackets I consider visual noise in all languages- they are not needed in modern times.
When typying, brain gets used to indentation quickly and VC creates vertical lines anyway to know what is where.
To bring back simplicity, the GO Environment should have option to auto hide brackets and replace with indentation or allow to type with indentation only (and auto create {} in the background- visually they not needed), option either type that or that. Auto convert instantly.

You would get more people from Python using Go- and it is good language but {} are no go for me. It is just noise.

This is example from W3School tutorial: ugly GO looking code, more complex code and you end up with too many brackets adding more lines of code, and time needed for brain to comprehend it, which is for what part.
These {} old school way should be eventually dropped while compiler still recognize it on old code, but allow to type modern way and instantly convert to curly brackets if needed to review, for those that prefer it.

package main
import ("fmt")

func main() { 
  for i:=0; i < 5; i++ {
    fmt.Println(i)
  }
}

package main
import ("fmt")

func main() {
  temperature := 14
  if (temperature > 15) {
    fmt.Println("It is warm out there")
  } else {
    fmt.Println("It is cold out there")
  }
}

In Python it is triumph of simplicity, clean code and it was easier in BASIC compared to GO:

for i in range(5):
    print(i)

temperature = 14

if temperature > 15:
    print("It is warm out there")
else:
    print("It is cold out there")

There need to be some standardisation and I would say Python solved it the best.
Regards
Michal

Language Spec Changes

Applies to Editor only, environment code is typed

Informal Change

No response

Is this change backward compatible?

YES

Orthogonality: How does this change interact or overlap with existing features?

No response

Would this change make Go easier or harder to learn, and why?

Easier for Python developers

Cost Description

No response

Changes to Go ToolChain

No response

Performance Costs

No response

Prototype

No response

@Liebenfiels Liebenfiels added LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee Proposal labels Oct 21, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gopherbot gopherbot added this to the Proposal milestone Oct 21, 2024
@Liebenfiels
Copy link
Author

Liebenfiels commented Oct 21, 2024

My proposal is about option to change in Editor as per user choice and convert if needed, not to get rid per say. Like you have options to change colors etc, but I would go for auto-formating and option to type with indentation and live convert instantly - should not time delay

@seankhliao
Copy link
Member

This looks like a proposal for an editor config setting, not something for the Go project.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
@Liebenfiels
Copy link
Author

GO community could test it and start with their GO environment to get more adoption- so it is GO language related indeed.

@ianlancetaylor
Copy link
Member

It is Go related, but as the Go project does not provide an editor, this is not something that the Go project can fix. Opening an issue in this issue tracker is unhelpful, as we won't be able to make any progress on it. We don't use the issue tracker for general projects; we use it for things that we can fix. Thanks.

@Liebenfiels
Copy link
Author

A part of Python success is that comes with simply to use note pad like editor, as simply as BASIC had at time. Has all functionality needed and it is good start for user after download. I am surprise to hear that GO has no editor, this would help adoption. Editor with some simply tutorial to follow and with added format options as mentioned would be and advantage.

@ianlancetaylor
Copy link
Member

Go has followed a path of providing an editor plugin that works with modern editors. See https://pkg.go.dev/golang.org/x/tools/gopls.

@Liebenfiels
Copy link
Author

Liebenfiels commented Oct 30, 2024

Ok I use Visual Code for Python so will give it a GO as there is logic in this language and rel easy syntax. Brackets I will have get use to I guess. I see that C open slide library can be linked.
What is important is compiled, has goto (asset) and no classes which I don't like.
I still use old 1990 Microsoft QBASIC for prototyping under DosBox as all is in one and quick, learning still (good programming books 80-90s are from BASIC, like QBASIC by examples- proper programming standard) and then applying that while learning Python.

I will do testing for speed like for loop 1 to 1 Billion for loop count etc then for image analysis.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LanguageChange Suggested changes to the Go language LanguageChangeReview Discussed by language change review committee Proposal
Projects
None yet
Development

No branches or pull requests

6 participants
@ianlancetaylor @gopherbot @seankhliao @Liebenfiels @gabyhelp and others