Skip to content

Obj.magic() causes code execution to failΒ #224

@jozanza

Description

@jozanza

I'm really loving Sketch πŸŽ‰, however, I ran into problems trying to use OCaml's Queue module -- the types all checked out, and code execution ran without issue, until I actually called Queue.create().

After some digging, I realized that Queue uses some unsafe type coercion via Obj.magic() in a number of methods; Queue.create() is one of them.

Further testing revealed that Obj.magic() worked in cases involving bool, int, and float, but broke code execution when used to assign string or record type.

I have a Sketch that illustrates the problem in more detail:
https://sketch.sh/s/O5RAG6SC1rDRGzTu3d6GaU/

Right now, it seems like the only possible workaround is to roll my own Queue module. I'm still fairly new when it comes to reason/ocaml, but I'd love to help out if possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions