Skip to content
This repository was archived by the owner on Jan 27, 2021. It is now read-only.
This repository was archived by the owner on Jan 27, 2021. It is now read-only.

Automatically generating dependent type messages #85

@prpr2770

Description

@prpr2770

As per the implementation in QUIC, I understand that it's possible to send messages with dependent types. I would like to get some help in implementing this approach. The usecase I have is as follows:

I wish to generate message packets that are of this basic structure, where the load4 may or may not exist at all times.

    object datagram = {
        type this = struct{
            load1 : packetload,
            load2 : packetload,
            load3 : control,
            load4 : family
            }

    }

Further, if control is the following enumerated-type

type control = {msg1, msg2, msg3, msg4, msg5}

and family is a collection of data-types defined as follows

object family ={
    type this

    object family1 ={
        variant this of family = {f1msg1, f1msg2, f1msg3, f1msg4}
    }

    object family2 = {
        variant this of family = {f2msg1, f2msg2, f2msg3, f2msg4, f2msg5, f2msg6}
    }
}

I would like to select the type of datagram.load4 based on the value of datagram.load3 .i.e in the scenario where we have

if(datagram.load3 = msg1) { datagram.load4 : family1 ;}
else if (datagram.load3 = msg2) {datagram.load4 : family2; }

If the above two situations do not exist, then datagram.load4 = Not Defined .i.e the datagram shall only consist of 3 components {load1, load2, load3}
How should one define these structures, to ensure that the messages are _generated() based on the above criteria?
Further, how should the encoder, decoder be designed for the same?

I am currently trying to explore Ivy to figure out how to achieve this functionality based on the Networking Branch defined encoder/decoder architecture. I would really appreciate some guidance in this regard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions