Self-host: Protocol prefixing broken for three- (or more) segment namespaces

Description

There is a protocol-prefix method in core.cljc (and also, in compiler.cljc) which employs .replace. In Java, this ends up replacing all occurrences of the old character with the new character, while in JavaScript, the same call only replaces the first character.

This results in breakage if attempting to make use of protocols in three- (or more) segment namespaces under self-host as the resulting emitted JavaScript will have some . characters in the namespace not converted to $ characters as desired.

Take for example the following REPL interaction

This will work fine in, say, noderepljs, where a line like the following appears in the emitted JavaScript:

but in a self-host REPL, this will cause JavaScript to be emitted that looks like this:

which will fail to be evaluated properly.

Environment

None

Attachments

1

Activity

Show:

Mike FikesOctober 30, 2015 at 8:38 PM

Attached a patch that address the self-host issue.

Completed

Details

Assignee

Reporter

Labels

Affects versions

Priority

Created October 30, 2015 at 4:14 AM
Updated October 31, 2015 at 6:12 PM
Resolved October 31, 2015 at 6:12 PM