Change generated code based on the project's dependencies #67
Replies: 5 comments
-
hmm, maybe we could have an approach where this lib doesn't depend on any of these other libs. Couple of reasons:
Maybe an approach could be:
|
Beta Was this translation helpful? Give feedback.
-
To me it seems the point of this library is a large part to remove conversion boilerplate, so it would be a shame to add it back. Selecting based upon dependencies may not always work, but I think it would be vast majority of the time, so there could be a lot of value there. Another option may be to have some explicit configuration in gleam.toml. If there's multiple dependencies that could be selected from they'll need to no longer be dependencies of Squirrel to avoid pulling in unused deps, so Squirrel would need to implement checking the project deps and erroring if the package required by the codegen is absent or of an unsupported version. |
Beta Was this translation helpful? Give feedback.
-
Totally agree! I think having some sort of configuration in gleam.toml could be the way to go |
Beta Was this translation helpful? Give feedback.
-
Either way I think it'd be good to wait until users feel some irritation with the current system before we expand it, so we know more about the situation. |
Beta Was this translation helpful? Give feedback.
-
As Inoas pointed out on Discord, it would be nice to have a way to avoid having a hard dependency on any specific library for supported types (eg youid for uuids); otherwise we'd end up having a set of blessed squirrel packages.
Louis proposed that squirrel could generate code for the specific dependency you have: let's say you have another uuid library as a dependency of your package, squirrel could detect it and generate code appropriate for it instead of defaulting to youid
Beta Was this translation helpful? Give feedback.
All reactions