Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
atilaneves
on March 29, 2024
|
parent
|
context
|
favorite
| on:
Representing State as Interfaces in Go
Wouldn't the instance state here be "was constructed"? That is: you should always be able to call `Read` because the constructor opened the file, and you shouldn't have to call `Close` anyway because the destructor did.
tonyhb
on March 30, 2024
[–]
I suppose it depends on the API. Some languages require grabbing a handle and calling open. Either way, theory is the same!
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: