Skip to content

Connectable protocol #19

@hamiltop

Description

@hamiltop

First pass at a protocol is

defprotocol Mergeable do

The goal is to make this more generic (not just specific to merge). Initial thought is:

defprotocol Connectable do
  def connect(source, target)
  def disconnect(connection)
end

I think that connect should return some sort of connection. disconnect will accept that as an input. This will contain the protocol so implementations can do whatever they want.

Potential uses:

Stream.Merge would connect each of the substreams to the target, allowing us to collapse nested merges.

GenEvent.Streams could be merged without an intermediate process.

Stream.Interval could call :timer.send_interval rather than spawn a new process. disconnect would cancel the timer.

and more...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions