Skip to content

Syntax entry for $ (dollar sign) #186

@shaunlebron

Description

@shaunlebron

As of 1.10.844, dollar signs can be used to refer to nested namespaces in JS:
https://clojurescript.org/news/2021-04-06-release#_library_property_namespaces

(ns foo
  (:require [react-native$NativeModules.SomeBridge :as woz]))

This might be related to inner class names in Clojure, due to JVM rules:
https://clojure.org/reference/java_interop

Note that nested classes are named EnclosingClass$NestedClass, per the JVM spec

But it also looks like a convention from Closure Compiler in JS used to flatten foo.bar.baz to foo$bar$baz but I can’t remember how to find this. This mentions it for renaming anonymous functions:
https://github.com/roman01la/closure-compiler-handbook#anonymous-functions-naming

math.simple.add = function $math$simple$add$(a, b) {
  return a + b;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions