Fork me on GitHub

Q: I’ve just started playing with clj-cdk and it’s style of importing interop deps doesn’t play well with Cursive.


That’s a little strange. Unfortunately there’s no good way to handle that apart from adding explicit support to Cursive. What is that import actually doing?


It is an interesting combo but super useful. It’s jvm clojure importing some kind of Typescript bridging libs (called jsii in the docs)


The import is pulling in support for constructor fns for various parts of the AWS CDK api. there’s a conj talk about it if you want a better understanding


might be best for @UGM2P65B7 to comment on this


Are there any tricks for working with these kinds of imports? My workaround will be to isolate them in another namespace but it hinders the exploratory experience so I thought I’d ask


I’m not sure why they chose that particular syntax for imports. The equivalent typescript is, I believe:

import { Stack } from '@aws-cdk/core';
import { Bucket } from '@aws-cdk/aws-s3';
Not sure what would be lost if the syntax were something like:
(cdk/require '[aws-cdk/core :refer [Stack]])
(cdk/require '[aws-cdk/aws-s3 :refer [Bucket]])
Then maybe by resolving cdk/require as clojure.core/require, cursive could resolve the symbols? I guess you could try writing such a require macro and see if it works.


I don’t speak Typescript (or NPM above a very basic level), but what is that import doing that the standard nodejs requires in CLJS don’t?


If the typescript compilation target is nodejs (commonJS), then its identical to var mod_1 = require('@aws-cdk/core'); var Stack = mod_1.Stack;


Hey guys, I was wondering if there is a way to configure the repls I start (using deps) to eval automatically (set! *warn-on-reflection* true) ?


@U0FR867U1 You should be able to do that using a user.clj, which is not Cursive-specific. I have plans to allow some startup commands to be added to a particular run config, but that’s not possible yet.


Hi @U0567Q30W do you mean create a user.clj namespace? Relying on the fact that it should be loading automatically? That’s clever I didn’t think of that at all. Thanks Colin.


Yes, that’s right. Stuart Sierra has a blog post on it IIRC.


I tried this but it didn't work for some reason. I only did a tiny bit of investigation into it and it appears that (set! *warn-on-reflection* true) only applies to the thread it's run on. Repl startup seems to be happening on a different thread than stuff like 'send form to repl'


Hmm, yes, that’s possible. I’ll see about adding that field to the run configs.


For the record IIRC I also tried it with cli repls, and I think it didn't work there either, but I'd have to verify that. It could be a lot of places where this gets decided, including the type of repl you use, whether it's local or remote etc. Another thing I'm unsure about is how this behaves when you start new threads in your code, either manually or by relying on futures, pmap, core.async etc.


I created a repo to demonstrate the issue(?)


What's the "safest" version of IntelliJ to be on at the moment? I'm currently on 2019.1.4 and am wondering whether to update, or maybe downgrade back to 2018 series?


Actually, I should mail the list about this. AFAIK 2019.3 with 1.9.0 should be fine now.

👍 4

I’m using that with no problems.


Great, thanks!