Skip to content

clear semantics of function equality #1761

@jmid

Description

@jmid

Consider

let v = (=) bool_of_string bool_of_string in ""

With BuckleScript 1.8.0 (Using OCaml4.02.3+BS ) it compiles to:

// Generated by BUCKLESCRIPT VERSION 1.8.0, PLEASE EDIT WITH CARE
'use strict';

var Caml_obj   = require("bs-platform/lib/js/caml_obj.js");
var Pervasives = require("bs-platform/lib/js/pervasives.js");

Caml_obj.caml_equal(Pervasives.bool_of_string, Pervasives.bool_of_string);

/*  Not a pure module */

However the comparison of the (identical) funtional values succeeds at run time,
contrary to the specification of (=) http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html
and OCaml's bytecode backend, which errors with Exception: Invalid_argument "equal: functional value".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions