You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really like that go support adding an interface abstraction (facade) on the using side with no requirement on the source package to define the facade. What is the reasoning of not doing that here?
I haven't dug into the code yet, but I assume returning the concrete type is feasible with this new simplified api. Isn't it possible to remove the duplicate code either by composition or by single line methods calling a common function. Or by providing the jetstream struct as an argument to a bare function instead (just like how jetstream connect to a nats connection without being a method on the nats connection.
That function could receive either any and switch to see if it's a jetstream, a stream or whatnot, or it could accept an interface without the need for other functions/methods to return that interface
If we're aiming for a simpler interface, I would argue returning concrete types, accepting interfaces or use generics to manage what can be provided to a function.
I think a simpler interface would borrow more from examples like context or nats own way to connect jetstream to nats. As functions with the handle as an argument.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I really like that go support adding an interface abstraction (facade) on the using side with no requirement on the source package to define the facade. What is the reasoning of not doing that here?
I haven't dug into the code yet, but I assume returning the concrete type is feasible with this new simplified api. Isn't it possible to remove the duplicate code either by composition or by single line methods calling a common function. Or by providing the jetstream struct as an argument to a bare function instead (just like how jetstream connect to a nats connection without being a method on the nats connection.
That function could receive either any and switch to see if it's a jetstream, a stream or whatnot, or it could accept an interface without the need for other functions/methods to return that interface
If we're aiming for a simpler interface, I would argue returning concrete types, accepting interfaces or use generics to manage what can be provided to a function.
I think a simpler interface would borrow more from examples like context or nats own way to connect jetstream to nats. As functions with the handle as an argument.
Options?
/T
Beta Was this translation helpful? Give feedback.
All reactions