Skip to content

turn max length consts into global vars#92

Merged
whyrusleeping merged 1 commit intomasterfrom
feat/const-maxlen-to-var
Feb 1, 2024
Merged

turn max length consts into global vars#92
whyrusleeping merged 1 commit intomasterfrom
feat/const-maxlen-to-var

Conversation

@whyrusleeping
Copy link
Copy Markdown
Owner

Sometimes you just want to set these globally

@whyrusleeping
Copy link
Copy Markdown
Owner Author

steb im still eventually interested in getting a thumbs up from you but it seems low risk enough to merge this

@whyrusleeping whyrusleeping merged commit bf2168c into master Feb 1, 2024
@Stebalien
Copy link
Copy Markdown
Collaborator

Can we make it an option during codegen instead? Maybe a new WriteEncodersToFile that includes a Config object with options like:

  • Representation (tuple/map).
  • Default max bytestring length.
  • Default max array length.

Etc?

Globals like this can make two different seemingly compatible libraries can't actually be used together.

@Stebalien
Copy link
Copy Markdown
Collaborator

Hm. Even better:

type Gen struct {
    TupleEncoding  []any
    MapEncoding    []any
    PackageName    string
    MaxByteLength  int    // 0 for default
    MaxArrayLength int    // 0 for default
}

func (g *Gen) WriteTo(filename string) error {
    // ...
}

(or something like that)

@whyrusleeping
Copy link
Copy Markdown
Owner Author

Oh i like that appoach

rvagg added a commit to filecoin-project/go-amt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-hamt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-hamt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-amt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-amt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-hamt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to filecoin-project/go-hamt-ipld that referenced this pull request Feb 6, 2024
rvagg added a commit to rvagg/cbor-gen that referenced this pull request Feb 6, 2024
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.

3 participants