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

turn max length consts into global vars #92

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

whyrusleeping
Copy link
Owner

Sometimes you just want to set these globally

@whyrusleeping
Copy link
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
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
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
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