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

Generic operation canary #6338

Closed
vicuna opened this issue Mar 5, 2014 · 5 comments
Closed

Generic operation canary #6338

vicuna opened this issue Mar 5, 2014 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Mar 5, 2014

Original bug ID: 6338
Reporter: @ppedrot
Status: acknowledged (set by @damiendoligez on 2014-07-16T13:32:12Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.01.0
Category: standard library
Tags: patch

Bug description

I would like OCaml to have a dedicated object guaranteed to fail when trying to use generic equality, hash or (de)serialization on it (or any combination of those three). This useful to check that in a huge codebase someone does not use such abstraction-breaking operations on it. In particular, I believe we need it in Coq quite badly.

This can be done using custom blocks. I give the particular example we need in Coq (which is serializable but neither comparable nor hashable) as an attachment.

I assume it would be better in the stdlib, because it requires writing C stubs, which is bad from the point of view of (Coq's) self-containedness. Feel free to reject this request if you think it has nothing to do there...

File attachments

@vicuna vicuna added the stdlib label Mar 14, 2019
@ejgallego
Copy link

Umm, I am not sure a "canary" is the right solution here; it seems to me that the right solution would be to mask the corresponding Stdlib module and make those operators unavailable.

@nojb
Copy link
Contributor

nojb commented Mar 15, 2019

See also #1642

@alainfrisch
Copy link
Contributor

@ejgallego : Hiding the generic operations and all Stdlib functions that rely on them (the whole non-functorized Hashtbl, List.assoc, etc) is not realistic in practice (at least before we get modular implicits), and there are many legitimate use cases. Being able to mark values in order to detect wrong use of the generic operations on specific data structures is a simple and nice addition, IMO.

@ejgallego
Copy link

Oh indeed very good point; I was thinking more of the original context to avoid using the polymorphic operators in Coq; IMHO there we should just enforce that by hiding.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants