Functions and receivers func ( r receiver)

Just working on terminology here

Yes. But even though its of type receiver, its not necessarily the receiver of a method, as the snippet you have shown is either incomplete (it lacks the actual method name, arguments and return type) or is the type of a function that takes a single argument of type receiver and returns nothing/void

To be more specific, when Go speaks of an identifier, is this a term that is specific to Go? And/or programming? Or are we to understand “identifier” as the common English definition “a person or thing that identifies something.” In looking for this last, I found, "COMPUTING a sequence of characters used to identify or refer to a program or an element, such as a variable or a set of data, within it.
I must be on the right track.
While possibly seeming elementary, this word has sounded like a foreign language to me, as I consider all the elements of Go until I know their definition specifically.

This is useful

More terms that almost, but not quite, mystify me.

Method, I have no clue.

Name, I’ve got down.

Arguments, I’m starting to get, but I don’t have a clear definition.

Return, all I’ve got in my head is that it’s something that returns something…so a bit nebulous.

Type used to really confuse me. Previously type to me was something that you typed, ie with a typewriter (I’m old) or computer keyboard. This definition has been very helpful to me: “a classification of data”

May I point you back to this advice?

I fear that for you Go and this forum are not good choices for starting to learn programming.

A completely different approach could be Scheme and the very good and thorough book How to Design Programs (available online). Please take a look, not to short, at this book. Spend some hours or days trying to understand what it teaches. Perhaps this is an approach that works for you.

Thank you for your opinion, but I don’t think you are correct

I understand it as “the target parameter”.

1 Like

i was taking notes while taking an online tutorial:

import “fmt” /*grabs the “format” module from the package main…you can use
fmt.Println with this. you can add an alias to “fmt” ex: import f “fmt”
this will allow you to use f.Println() instead of fmt.Println(). Can be useful
for long named imports. */

so, based on this, I believe you’re giving ‘receiver’ the alias r, so that when you call on it later, you can just type r instead of having to spell out receiver. that’s my guess anyways…someone correct me if i’m wrong 'cause I’m still learning. :stuck_out_tongue:

1 Like

What you describe is not the receiver of a method. It is an alias for an import.

package main

import (
	f "fmt"
)

func main() {
	f.Println("Hello, playground")
}

Here f is an alias for fmt. This can be useful to avoid name clashes.

To learn about what a receiver is, please read the documentation. A good starting point is the Go Tour. In addition, the book The Go Programming Language is still a very good guide to learn Go.

Wild guesses and hearsay are not recommended to learn anything.

2 Likes

Ah! I was looking for this: A method is a function with a special receiver argument.

By the way, I discovered I am on page 17 of the second module? or lesson of the tour. I have also made it a Chrome favorite three times. I’ve resolved to make my way through the tour as time allows.

Your and others specific references to the tour are very helpful to me.

Does Vertex have special significance in Go?

No, it is just a name of a type in that particular example.

1 Like

Thankfully I have important people in my life who would disagree with you and several others who concur with you. One is my sister, who of course knows me intimately and has the opinion that I will succeed at anything I put my mind to. By the way, my sister is a successful systems engineer who previously dropped out of high school. She thinks I am smarter than her.
The second person is my teacher who believes, all things considered, that I have made great progress. I choose to follow the guidance of these two important people rather than you guys who would discourage me…to what purpose I can’ figure out. Why should you care? Isn’t that my business?
On this, “within a reasonable time”, I have my whole life! If I should die or become senile before I become proficient in Go, I still feel I will have benefitted from it’s study. So please, back off! :wink: (Said lovingly)

1 Like

“the target parameter”

Very interesting. Please expand.

import “fmt” /*grabs the “format” module from the package main…you can use
fmt.Println with this. you can add an alias to “fmt” ex: import f “fmt”
this will allow you to use f.Println() instead of fmt.Println(). Can be useful
for long named imports. */

This is interesting, but a little beyond me
whereas this "so, based on this, I believe you’re giving ‘receiver’ the alias r, so that when you call on it later, you can just type r instead of having to spell out receiver. " is VERY helpful

But not what actually happens!

r is not an alias of receiver! r is of type receiver in the example you have shown. Function/Method declarations are semantically and syntactically distinct from the import statements.

Go Tour

Thank you for this. I have read this page several times today, and it’s getting more and more clear.

Thanks. I will get it! I know I’ve asked similar questions about identifiers previously. I guess I’m trying to be sure it holds true in every instance.

r is not an alias of receiver

But I thinks what he’s saying is that r is the name of the receiver. It is the name, correct?

Which I totally understand.

No one here tries to discourage you, we only try to find a path for you that suites you better.

Also the problem with most people met online is, that they might stop helping when they have the feeling that the person asking doesn’t seem to understand and asks the same stuff that has been answered a thousand times, again and again.

We do not want happen this to you.

Also your style of asking makes it sometimes hard to actually find your questions and/or statements between quotes that you do not mark properly as such. Also code, just copy/pasted into your prose is hard to follow, not only it is not marked as code, but also missing a paren here or a bracket there.

And even though your questions sometimes are hard to read or even understand, I’ll try to answer as good as I can, as even though I think there are better ways for you to learn, but not answering you will teach you even less…