Why having a receiver if you are going to discard it? What would be
the advantage of using a T.New() method instead of a NewT() function?
--
- yiyus || JGL .
I don't get the value here. My thoughts are:
- If some_fun only needs a "meaningless variable" of type T, then why
is it a method on T in the first place? Why not just remove that
parameter and make it a normal function?
- This is really asking a lot of the compiler. Consider:
func Foo(t T) {
t.some_fun()
}
How can the compiler to statically know whether t contains the zero value for T?
- Evan
Don't get me wrong. Methods are a brilliant invention that Go exploits to its great benefit. But the same sentence applies with "functions" as the first word.
A static method is not a method, it is an OOO misnomer from a confused age. It is just a function. And look! Go has functions. Problem solved. Nomenclature rebuffed.
-rob
Agreed.
A method is a function with a special convention for its arguments.
--
Sterling (Chip) Camden | ster...@camdensoftware.com | 2048D/3A978E4F
http://chipsquips.com | http://camdensoftware.com | http://chipstips.com
for types that allow being passed by value, there's always a zero
value expression.
for structs it's T{}
e.g. T{}.some_fun().
for non-structs, it's a type conversion from the literal,
e.g. os.Errno(5).String()
the same as for structs.
e.g.
type T [100]int
func (t T) some_fun() { }
T{}.some_fun()
I doubt I'm alone in regarding the tone of this email as unnecessarily
combative. You raise some valid points but they are clouded by
negativity. Your message would be more constructive without the
vitriol:
`
Your proposal raises questions about performance, in that you want the
primitive "function call" to create new data. Also, the syntax
conflicts with existing syntax of the Go language. This seems more
dangerous than the controversial idea of allowing any pointer in a
programming language to be 'nil'.
However, I am open to being persuaded otherwise.
`
I apologize for calling ⚛ out in particular, but I think the general
level of civility in golang-nuts should be raised.
Andrew
i think you're saying that because you're unhappy, you're
just going to splatter golang-nuts with the resulting bile
and you think that's ok.
that's a very sad attitude.
cheer up!
On Thursday, March 03, 2011 12:28:51 am ⚛ wrote:
> I think you don't recognize the cause of the behavior. It is a matter
> of cause-and-effect. If someone feels that society *in general* (i.e:
> outside of golang-nuts) is not being nice to him/her, it is only
> *logical* to return the "favor" in some form. Until the cause is
> removed, it is irrational to behave differently. Sorry, but that is
> the plain truth here.
I disagree with this being the *logical* solution. It is reaction from a certain point of view, one that isn't disposed to letting people be who they are. There is such a thing as ignore it and go on with buisness, let the distractions go.
If you feel challenged or disrespected, in this case, the only challenge that matters is one where your life is at stake (or you're physically challenged). Last time I checked no one actually hit or killed anyone throwing a few words around on a mailing list (in a bar is another matter). Really how important are insults and/or comments that appear to be insulting, to let it bother you?
Overall for the look and feel of golang-nuts, Andrew has a point. I haven't really noticed it, but I also tend to gloss over those parts and try to extract the important information. In *'s original post, before Andrew pointed it out, I didn't notice it, but I was not looking for it. There is a point where the reader needs to take responsibility in terms of ignoring the ego's and antagonistic remarks. .
My less than two cents.
Mike
--
This generation doesn't have emotional baggage. We have emotional moving vans.
-- Bruce Feirstein