clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
razum2um 2019-02-23T17:48:46.042100Z

I wonder, why (resolve 'n/x) ;; => nil silently if n is not required? I see at least 2 other choices: 1) auto require n (possibly bad due side-effects while classloading) 2) throw error

2019-02-23T17:49:51.042600Z

I think there's a new variant of resolve that auto-requires

2019-02-23T17:51:38.044800Z

an error could arguably be more useful since resolve could fail for two different reasons and you can't tell which it is based on nil, but that would be a breaking change, and I'm 103% certain that won't happen for something in clojure.core without providing a lot more benefit than this

razum2um 2019-02-23T17:52:30.045300Z

yep, I don’t believe in change, just wonder about the design decision..

razum2um 2019-02-23T17:52:33.045500Z

and this is actually not only about calling resolve directly. Same applies if it’s a fn call (n/x args) - why not to try to autoload ns

2019-02-23T17:53:21.045800Z

what's similar about this?

user=> (n/x 42)
Syntax error compiling at (REPL:1:1).
No such namespace: n

razum2um 2019-02-23T17:55:30.046800Z

*fixed, I meant fully qualified call could try auto-require

ghadi 2019-02-23T17:57:50.047800Z

see requiring-resolve in 1.10

👍 2
2019-02-23T20:31:49.048700Z

my initial reaction is that that's a crazy idea, but I'm having trouble putting my finger on really compelling reasons; I bet other people will have ideas

bronsa 2019-02-23T20:39:50.049600Z

namespace loading is side effecty, you don't want it to happen automagically

2019-02-23T20:50:53.049900Z

but why would you type foo/bar if you didn't want it loaded?

➕ 1
2019-02-23T20:51:26.050300Z

I was thinking along those lines, but couldn't put my finger on why that was a good enough reason

2019-02-23T21:08:45.050700Z

I think there are questions of when the loading happens

2019-02-23T21:09:29.051600Z

and it ends up in similar territory to forward declarations

2019-02-23T21:11:02.053200Z

like for (defn f [] (foo/bar)), when would foo be loaded? at runtime or compile time? when the class that implements f is loaded or when f is actually invoked?

2019-02-23T21:14:27.054100Z

which isn't to say you can't decided on answers to the question, it is just that the design space is larger then you would expect and someone would have to traverse it

2019-02-23T21:28:16.054500Z

somehow I hadn't even thought of the "when the function is loaded vs first called" question

2019-02-23T21:28:26.054800Z

I guess it'd have to be loaded, if you want a compile error for missing bar

2019-02-23T21:28:59.055Z

so that much at least seems well-defined

2019-02-23T21:29:37.055400Z

it has to be compiled time if foo/bar is a macro

2019-02-23T21:30:04.055700Z

oh right, which you can't even tell w/o loading it