cljs-dev

dnolen 2025-01-14T03:50:44.880429Z

(:refer-global [HTMLElement ImageData ...]) (:require-global [SomeThingy :refer [baz]]) ?

dnolen 2025-01-17T15:00:41.099379Z

but that is the idea, if it's a standard browser thing externs can remove any ambiguities for sure.

dnolen 2025-01-14T12:25:23.688009Z

that's not what :refer-global does, it's just a way to get global "vars", at most it would support :rename - it will never throw - because the "global" namespace is always there.

dnolen 2025-01-14T12:26:59.256479Z

:require-global lets you treat some global var as a namespace. it supports the usual :require things - it will throw at runtime if a library cannot be found.

dnolen 2025-01-14T12:27:18.901089Z

both of these behave differently from :require which always throws at compile time if the library cannot be resolved.

souenzzo 2025-01-14T15:59:19.418699Z

(:refer-global [Reflect]) and then use as (Reflect/get #js{:a 42}) => 42 ?

dnolen 2025-01-14T18:00:05.651399Z

there's are challenges w/ method values I don't want to bring up here, for the time being.

thheller 2025-01-14T07:51:13.385519Z

is the intent to still allow setting up :as aliases? and nested access? (:refer-global [some.thing :as x]) and (x/foo ...) later?

thheller 2025-01-14T07:52:51.057739Z

I don't really see how :refer-global is any better than (:require [global:...]) or cljs.host..