Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sshirokov/336 transport #340

Merged
merged 16 commits into from
Apr 11, 2024

Conversation

serges147
Copy link
Collaborator

  • Added ITransport, ICanTransport & IUpdTransport
  • PayloadFragment now immutable; FragmentBuffer is mutable span.

@serges147 serges147 self-assigned this Apr 10, 2024
@serges147 serges147 marked this pull request as ready for review April 10, 2024 14:10
public:
Factory() = delete;

CETL_NODISCARD static inline Expected<UniquePtr<ICanTransport>, FactoryError> make(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this be a freestanding function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My rationale was to avoid freestanding functions (which for my taste a bit "c-style"), but instead you know "encapsulate" them into some sort of entity (like this Factory). Also, IMHO if we apply such pattern everywhere then it will be easier for users to guess where to find a factory method, like always <correct_namespace>::Factory::make(...) something. But in general I'm totally good with essentially the same <correct_namespace>::makeSomething(...) approach.

Probably it's again my Swift habits - there are no namespaces in Swift, so any freestanding function is GLOBAL one, which is considered as bad design - so you nest such functions in some (sub)type as static one.

Please let me know if my rationale is not applicable for c++, or there are reasons to specifically go with freestanding alternative. Thanks!

Copy link
Member

@pavel-kirienko pavel-kirienko Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think it applies here; we should rather keep things simple and use a freestanding function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix this in the next pr

public:
Factory() = delete;

CETL_NODISCARD static inline Expected<UniquePtr<ICanTransport>, FactoryError> make(
Copy link
Member

@pavel-kirienko pavel-kirienko Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think it applies here; we should rather keep things simple and use a freestanding function.

@serges147 serges147 merged commit 8e16a88 into issue/336_transport_iterfaces Apr 11, 2024
18 checks passed
@serges147 serges147 deleted the sshirokov/336_transport branch April 11, 2024 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants