Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If a nil is another implementation then interfaces with a single implementation don't exist.


Given the following, where is the nil implementation found?

    package main

    type FooInterface interface {
        Baz()
    }

    func bar(fizz FooInterface) {
        bizz.Baz()
    }

    type MyFoo struct{}

    func (*MyFoo) Baz() {}

    func main() {
        var foo FooInterface = &MyFoo{}
        bar(foo)
    }


Nil is built-in. You just have to write the code to instantiate it and the compiler gives you one. The coder does not need to create an implementation, it's there for free.

I would not have called it a "second implementation" myself, but that's your claim to defend, not mine.


map is also built-in. Where do you find the hash map in the given program?

By your logic some nebulous package in a random GitHub repository that happens to satisfy an interface is also another implementation, but you would have to be completely out to lunch to think that fits with the topic of discussion.


> map is also built-in. Where do you find the hash map in the given program?

If you told me a type can be optimized because the compiler knows it can only have non-hash-map uses, but I could put that type into a hash map with a single line, I think I would be right to be skeptical.

> By your logic some nebulous package in a GitHub repository that happens to satisfy an interface is also another implementation, but you would have to be completely out to lunch to think that fits with the topic of discussion.

I expect the compiler to have a list of implementations somewhere. I don't know if I can expect it to track if nil is ever used with an interface. I could believe the optimization exists with the right analysis setup but you called the idea of finding a citation a "waste of time" so that's not very convincing.


> but you called the idea of finding a citation a "waste of time" so that's not very convincing.

Not only a waste of time, but straight up illogical. If one wants to have a discussion with someone else, they can go to that someone else. There is no logical reason for me to be a pointless middleman even if time were infinite.

Now, as fun as that tangent was, where is the nil implementation and hash map found in the given program?


You can head over to godbolt.org and see for yourself that changing the value to nil doesn't change the implementation of `bar`, though it does cause `main` to gain a body rather than returning immediately.


The implementation is preexisting. Even if it was directly used, there would not be an implementation in the snippet. So it not being implemented in the snippet proves nothing.

And what do you mean "someone else"? You're the one that said the compiler "certainly knows" how to do that.


> So it not being implemented in the snippet proves nothing.

It doesn't prove anything, but is what we've been talking about. Indeed, there is nothing to prove. Never was. What is it with this weird obsession you have with being convinced by something? Nobody was ever trying to convince you of anything, nor would there be any reason to ever try to. That would be a pointless endeavour.

> And what do you mean "someone else"?

He who wrote the "citation".


> there is nothing to prove. Never was.

What was the point of your question, if not to prove something?

If you were trying to imply that the implementation doesn't exist, that implication was fatally flawed.

If you were asking to waste time, then it worked.

If you had another motive, what was it?

Are we having a 5d chess game? I thought it was a normal conversation.

> He who wrote the "citation".

Nobody? Nobody wrote a citation.

Do you mean the person that asked for a citation? If so, you're wrong. Finding evidence for your own claims would not make you a middleman. They didn't want to have a discussion with someone else, they wanted a discussion with you, and for that discussion to have evidence. Citing evidence is not passing the buck to someone else, it's an important part of making claims.


> What was the point of your question, if not to prove something?

My enjoyment. For what other reason would you spend your free time doing something?

> If you were trying to imply that the implementation doesn't exist, that implication was fatally flawed.

And if I weren't trying?

> If you were asking to waste time, then it worked.

I ask nothing, but if you feel wasted your time, why? Why would you do such a thing?

> If you had another motive, what was it?

As before, my enjoyment. Same as you, I'm sure. What other possible reason could there be?

> Nobody? Nobody wrote a citation.

There was a request for me to refer another party who was willing to talk about the subject that was at hand – one that you made reference to ('you called the idea of finding a citation a "waste of time"'). Short memory?

> Finding evidence for your own claims would not make you a middleman.

There wasn't a request for evidence, there was a request for a citation. Those are very different things. A citation might provide some kind of pointer to help find evidence, which is what I suspect you mean, but, again, if that's what you seek then you're back to wanting to talk to someone else. If you want to talk to someone else, just go talk to them. There is no reason for me to serve as the middleman.

> it's an important part of making claims.

Nonsense. If my claim does not hold merit on its own, it doesn't merit further discovery. It's just not valuable at all. It can be left at that, or, if still enjoyable, can be talked about to the extent that remains enjoyable.

Perhaps you are under the mistaken impression that we are writing an academic research paper here? I can assure you that is not the case.


It's great that in your reply upthread you actually understood that it was a request for any kind of evidence, including evidence you just created on the spot, but now you pretend not to understand that.


What ever do you mean? There was no change in understanding. You spoke to seeking a proof in addition to a citation, the parent did not originally speak to the proof bit, only to a citation. Entirely different contexts.

In fact, you would have noticed, if you read it, that the "upstream" comment doesn't even touch on the citation at all. It is focused entirely on the proof aspect. While the parent wanted to talk about citations exclusively, at least at the onset. Very different things, very different topics.


Okay so confirmed you're going meta to dodge any actual points being made, and grind any possible progress of the conversation to a halt. Bye!


Confused by academic paper writing confirmed. What lead you down that path?


Normal conversations have people back up their claims, dude...

You're getting way more academic with this meta waste.


You could just go to godbolt.org, as others have already said, and as any normal person would do. Evidence is neither here nor there, though. We're talking about citations, which nobody of sound mind does. Why on earth would you have a conversation using someone else's words? That's the stupidest thing I have ever heard of.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: