-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
How to deal with versioning #4
Comments
This seems completely reasonable to me. If we adopt this proposal, I wonder whether the exported function should return a record rather than a string. Ideally it would be of type > type([1, 2, 3])
{namespace: null, name: 'Array', version: null}
> type(Future.of(42))
{namespace: 'fluture', name: 'Future', version: 4} Users of this function could then decide on the appropriate strictness when type checking. |
That would also make it easier to derive a type identifier. |
Are you interested in submitting a pull request, @Avaq? |
To get this clear; your idea is to:
|
Keeping MyType['@@type'] = 'my-package/MyType'; MyType['@@type'] = {
namespace: 'my-package',
name: 'MyType',
version: null,
}; Which approach do you favour? |
I prefer to keep it a String. This will also keep this change compatible with the previous spec, just not the export. About that... How to deal with versioning? ;) If we ever change the spec, how would a package indicate that it's using an older version on the spec? The same problem occurs in Fantasy Land. Maybe we should have the property named |
I suggest we wait until we make a breaking change to the |
ℹ️ This is on my to-do list for https://github.com/fluture-js/Fluture/projects/1 |
|
Relying on a
|
This commit adjusts the specification to allow for the inclusion of a version number in the type identifier. It also adds a utility function to the library which takes a string and parses it as a type identifier to separate the different parts. This function is exposed as `type.parse`. Furthermore, because this changed asked for a more extensive API documentation, the commit adds validation of the documentation by doctest. Closes #4 Closes #8 (supersedes)
This commit adjusts the specification to allow for the inclusion of a version number in the type identifier. It also adds a utility function to the library which takes a string and parses it as a type identifier to separate the different parts. This function is exposed as `type.parse`. Furthermore, because this chang asked for a more extensive API documentation, the commit adds validation of the documentation by doctest. Closes #4 Closes #8 (supersedes)
This commit adjusts the specification to allow for the inclusion of a version number in the type identifier. It also adds a utility function to the library which takes a string and parses it as a type identifier to separate the different parts. This function is exposed as `type.parse`. Furthermore, because this change asked for a more extensive API documentation, the commit adds validation of the documentation by doctest. Closes #4 Closes #8 (supersedes)
When using Sanctuary-Type-Identifiers to determine whether something is member of a specific desired type, we get a nice advantage: Even if the value was created in a different context (like in another VM or another package), it will still be identifiable as being our type.
However! When the type was created by an outdated package, we currently have no way to tell that this is actually not the desired type, when using the recommended format for
@@type
(<vendor>/<type>
).I've therefore been thinking to add a version number to my
@@type
values (eg<vendor>/<type>@<major>
). This would allow my type-checks to detect "older" versions of my type, which may no longer satisfy the interface I expect them to have. And it works both ways: An older version of my lib will not try to consume a newer version of its own type.Is this something you would stand behind @davidchambers? Or does this somehow go against the purpose of
@@type
?The text was updated successfully, but these errors were encountered: