Cannot read property 'length' of undefined?/Deprecated Format

I am messing around with [dbuenzil/note] with rescript at rescript-note.

When I try to run an example I get the following error:

node src/
  var arity = o.length;

TypeError: Cannot read property 'length' of undefined
    at Object._2 (/Users/mando/Github/rescript-note/node_modules/rescript/lib/js/curry.js:79:17)
    at Object.<anonymous> (/Users/mando/Github/rescript-note/src/
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/mando/Github/rescript-note/src/

This is the offending line per the error.
The project is compiling but the example is not running.

Also, I get this error on the deprecated Format module.

  121 โ”‚   let fix: (~eq: ('a, 'a) => bool=?, 'a, t<'a> => (t<'a>, 'b)) => 'b
  122 โ”‚   let defer: ('a, t<'a>) => t<'a>
  123 โ”‚   let dump_src_ids: (Format.formatter, t<'a>) => unit
  124 โ”‚ } = {
  125 โ”‚   type rec t<'a> = {

  deprecated: module Format

What is the recommend way to swap that out?

Thank you.

Hi, if you believe this is a bug, try to make a small self-contained example and file it on github, we will fix that.

What is the recommend way to swap that out?

This depends on your use of Format, if it is sprintf, you can use string interpolation. Here it seems only be used for debugging, in that case, Js.log may just work

1 Like

Thanks. Will think about that for a second.

I see now, in my haste, I did not properly formulate the question. I was not asking if it was a bug. Since it compiles and I have complete faith this team, I figured I was doing something wrong. So the question is, how do I resolve that issue?

Sounds like you think it might be a bug though. If it is a bug, I am happy to post an issue about it. So is it a bug?

The posted repo is a small self contained example I think. It is three files. Note.rei,` and the example file. No dependencies.

How can I tell if its a bug?

@idkjs I looked at your repo and it seems like a bug in recursive modules that use reserved names in JS. I submitted a bug report with a minimal reproduction here Rescursive modules and reserved identifier names are inconsistent ยท Issue #5161 ยท rescript-lang/rescript-compiler ยท GitHub


The compiler has been developed for many years, the chance of a bug is pretty low. If you could find a small reproducible example, I am happy to have a look(I am going to be pretty busy the next half, so I will only take a look at bug reports with enough details)

Since you are also using a fork and use patterns we recommend against (e.g redefining $ in this repo) so I am not really sure. If you are using a forked compiler, you should file issues there.


Brother @Hongbo. The project is strictly rescript created by following the commands on new-project. What indicates it is using a forked compiler? Maybe I did something wrong.

By discouraged pattern you must mean use-illegal-identifier-names. Thanks for taking the time to teach and reinforce that. I removed it on the dollar branch and got the same result if you are interested.

I can follow @johnjโ€™s bug report. @johnj thanks for the reproduction, I did not understand the issue enough to be able to reproduce it in a smaller context. Not for nothing, I have been getting this all over the place. I figured it was me (imposter syndrome), so I have not been reporting it. I will do so in the future. Thank you, gentlemen.