You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ended up writing something like this expression at some point, and I'm not sure if I had hit a documented problem, or if bucklescript is missing some Javascript semantics:
let _ =Js.Undefined.to_opt (Js.Undefined.return "") =Some""
This produces a runtime error regarding an undefined variable v, because of the generated Javascript:
// Generated by BUCKLESCRIPT VERSION 1.3.0 , PLEASE EDIT WITH CARE'use strict';varCaml_obj=require("bs-platform/lib/js/caml_obj");Caml_obj.caml_equal((v="",v===undefined ? /* None */0 : [v]),/* Some */[""]);/* Not a pure module */
It is simple enough to work-around by explicitly binding the Js.Undefined.return "" expression to a name, but it does seem like the bucklescript compiler should be able to declare new variables for any free ones it needs to create inside sub-expressions.
bsc.exe -v output:
The OCaml compiler, version BuckleScript 1.3.0 (Using OCaml4.02.3+BS )
Standard library directory: /home/bark/projects/bs-connect3/node_modules/bs-platform/lib/ocaml
Actually bs-platform is at version 1.3.1. I guess the -v output also needs to be updated.
The text was updated successfully, but these errors were encountered:
note current architecture requires primitive/ external call to return an expression(not a block), in the future, when refactoring, we should lift such restriction for better inlining
I ended up writing something like this expression at some point, and I'm not sure if I had hit a documented problem, or if bucklescript is missing some Javascript semantics:
This produces a runtime error regarding an undefined variable
v
, because of the generated Javascript:It is simple enough to work-around by explicitly binding the
Js.Undefined.return ""
expression to a name, but it does seem like the bucklescript compiler should be able to declare new variables for any free ones it needs to create inside sub-expressions.bsc.exe -v
output:Actually bs-platform is at version 1.3.1. I guess the
-v
output also needs to be updated.The text was updated successfully, but these errors were encountered: