[fun share] chatGPT to improve mixin

I try to ask chatGPT about improving code using mixin. see below:

1 Like

Thanks for sharing! But your screenshots are super small, could update?

Hi You need to click, it will prompt the picture, and then click again. The picture will then resize and become larger.

1 Like

Nice! I like it! Now I know what oviparous means too.

To clarify the advice ChatGPT gave you, you can actually use abstract classes as mixins as long as they include concrete methods. You can also use regular classes as mixins. However, if your only purpose is to share some code between classes, then it’s more clear to use the mixin keyword. You would only use a class as a mixin if you also needed it use it as a standalone class in addition to being a mixin.

I’ve added a TODO issue to the book repo to add more explanation about this to the next edition.

So how did you end up making your screenshot? Did you paste a bunch of screenshots together or did you find a way to do it automatically?

2 Likes

@suragch I end up using a Chrome extension called chatGPT screenshot to take the screenshot for me.
Thank you for your further clarification. This example showcases chatGPT cannot replace a real, nice, knowledgeable teacher like you. In this case, if you don’t clarify, I will be forced to believe with keyword can only be used with mixin.
chatGPT can easily to generate some seemingly authoritative knowledge, which can only be verified by a person with related subject matter knowledge. This can be dangerous and I should be aware of this when I use chatGPT later.

1 Like

That’s true about ChatGPT for sure. It sounds very authoritative even when saying something wrong. However, it’s also true for real humans. Listen to nearly any debate and you’ll hear someone sounding authoritative about something they’re wrong on. I’ve learned not to blindly trust titles and books, but to look into disputable matters for myself. The same goes for those reading the things I write. Challenge me where you think might be wrong. That’ll help us both.

2 Likes

Thank you for your advice!

1 Like