Skip to content

' (single quote) in function name causes javascript runtime error with node.js #40

Open
@mkarup

Description

@mkarup

It seems like ' (single quote) is valid syntax in variable and function names, in so far as it is accepted by the compiler,
but including a ' in a function name results in a javascript runtime error when using Node.js.

Example:

let fun f' x = x
in
    f' 42
end

fails with:

/tmp/tmp.js:7
  this.f'23 = ($env) => {
        ^^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1469:18)
    at Module._compile (node:internal/modules/cjs/loader:1491:20)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at cjsLoader (node:internal/modules/esm/translators:329:5)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:260:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:483:26)
    at async file:///home/troupe-project/troupe-dev/rt/built/troupe.mjs:17:13

Node.js version v22.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerCompiler-related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions