I personally think that in the specific case of OOP code syntactic sugar 
declarative structuring stuff - and maybe also godoc header comments such 
as within type struct and type interfaces would make Go code even more 
readable. There is limits to how far readability and consequential 
maintainability can be made. People can write their code with meaningless 
names or names that are hard to contextualise, use numbers where names 
could be trivially substituted to quantify conditions, and so on, but in my 
opinion, in Go, a lot of conventions about comment positions and 
relationships to documentation and code can ease a lot of things. 

For example, go fmt - it would be really useful if it automatically sorted 
implementations with interface definitions in a common ordering, and 
grouped them together, and even, automatically insert the boilerplate 
comment header for public methods that are missing implementations (or 
even, dare I say it, insert an empty dummy implementation as well). Other 
elements of OOP structuring are not so easy to automatically recognise as 
being linked together, though probably not that difficult, by searching for 
the collision of type bindings and interface signatures, so that the type 
struct is placed above the interface and the implementations below the 
interface and unimplemented function dummies below the implemented (and 
also sorted this way in the interface itself.

On Friday, 20 April 2018 09:21:39 UTC+3, Chris FractalBach wrote:
>
> Thanks everyone for posting.
> I poked my head around the standard library in search of comments,
> and the only file I found so far that uses --- lines:
>
> https://golang.org/src/go/ast/ast.go
>
> ... which is used to separate sections.
>
> // 
> ----------------------------------------------------------------------------
> // Interfaces
> //
>
>
>
>
> The most widespread use of the concept of "headers" is google's copyright 
> signature.
> Seems clean enough the way it is.
>
> In fact, I think a lot of the go source code is very readable, as is.
>
> =)
>
>
>

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

Reply via email to