Fork me on GitHub
#off-topic
<
2018-04-03
>
qqq01:04:22

Is it just me, or is IntelliJ auto completion insane? I've only played with it for the past 24-48 hours, and it's already at the point where I'm no longer using Chrome to browse javadocs api, and just letting auto completion fill in everything I need.

👍 8
vemv02:04:58

it's pretty ace for Java but for Clojure it's more noisy iirc, with an overly broad candidate pool

Alex Miller (Clojure team)03:04:11

there’s a reason every Java dev uses intellij or eclipse

Alex Miller (Clojure team)03:04:24

it can write all your boilerplate code for you

jgh03:04:23

i like sublime

jgh03:04:48

autocomplete is basically limited to whatever’s in the file, but that’s fine by me

Alex Miller (Clojure team)03:04:41

back in the early days, I wrote Java code in notepad. #notkidding

👍 4
dpsutton03:04:49

Ouch. We had a project in school where a guy was writing Java in gedit it was not pretty

Alex Miller (Clojure team)03:04:02

hard to believe that was over 20 years ago now

Alex Miller (Clojure team)03:04:22

admittedly, the jdk was a lot smaller then :)

Alex Miller (Clojure team)03:04:08

you could remember the whole thing

dpsutton03:04:55

This was I've written some Ruby before and don't want to set up a dev environment in the VM and how different can a programming language really be

seancorfield03:04:06

My favorite IDE for Java was Together/J -- you drew UML diagrams and it generated your code, then if you edited the source code it regenerated the UML diagrams!

jgh03:04:36

that’s pretty handy

seancorfield03:04:43

The full version was something like $5K per seat, if I remember correctly. But that did all the JEE stuff, including deployments etc.

Alex Miller (Clojure team)03:04:58

I used that for a bit… and VisualAge (IBM’s repurposed Smalltalk environment) and Rational Rose and Netbeans and JBuilder and on and on

Alex Miller (Clojure team)03:04:21

I remember what a lightning bolt Eclipse was. It was immediately apparent that someone had finally “gotten” it.

seancorfield04:04:01

Yeah, I moved on to Eclipse... and stayed with it for years... including trying CCW early on when I was learning Clojure.

sveri05:04:12

@qqq my understanding is that you have a few clojure / java / kotlin projects that all depend on library foobar.jar. Thaths why you want to make it permanently know to intellij by adding it to intellijs classpath. Did you mean something different?

qqq05:04:00

@sveri: that's a perfectly valid inference, but my actual problem is a bit different; I am writing an intellij plugin that fires off an clojure nrepl; but the newly launched ide can't find the clojure.jar; so I was trying to figure out if there was a way to install clojure.jar globally for all intellij projetsc

gklijs07:04:48

Can’t you include it in the plugin?

qqq07:04:52

That is precisely the problem. The clojure.jar dependency was not being bundled in into the plugin, I couldn't figure out what was going on, so one hacky solution was to just install Clojure.jar globally.

tbaldridge14:04:46

So every news site today is claiming that Apple is about to switch to non-Intel processors for Macs by 2020. Seems like the worst thing they could do at this point. Sure ARM is getting better (let's hope it's ARM-based), but I'm not convinced that they're even close to the level needed by average users.

michaels14:04:49

I wondered if that was due to the meltdown thing.

danm14:04:33

If they're staying x86 they could just go to AMD. But I would be surprised if that was the case

danm14:04:39

Well, x64

tbaldridge14:04:30

No, the news is they're moving to in-house fabrication. They did this with the iPhones/iPads/AppleTVs a few years back.

tbaldridge14:04:12

and yeah, I'm sure it has to do with a lot of things like meltdown and power consumption, and dealing with two instruction sets. Perhaps as well as problems shrinking x86 hardware into smaller laptops.

tbaldridge14:04:39

But there's the other side, like x86 branch prediction from Intel and AMD being some of the most advanced on the planet.

tbaldridge14:04:07

ARM has some pretty insane SIMD support, but none of that helps if your code is super branchy.

qqq15:04:29

I think most algorithms that involve Video, Photo, or Audio tend to leverage SIMD more than branch prediction. What type of tasks are (1) highly branchy and (2) likely to be used by a MBP or MacPro user ?

justinlee15:04:30

i wonder how much of the move is directed at power consumption rather than pure performance

tbaldridge15:04:26

@lee.justin.m I'm sure that's the case, I think it will kill a lot of their professional customer base though.

tbaldridge15:04:50

@qqq it's not so much about raw power, it's about problems of multi-tasking, badly written software, etc.

3Jane15:04:48

If they’re announcing it now, that means they’ve been working on the processors for some time already

tbaldridge15:04:18

Stuff like databases, compilers, etc. run "okay" on ARM in my experience, and yes they're more efficient power/performance. But there's some things you just can't make parallel. And then you're left with whatever the raw performance of the CPU is.

tbaldridge15:04:23

Making a efficient CPU is one thing, making a CPU that's not 1/10th the performance of an x86 CPU is really hard.

qqq15:04:33

Do these ARM CPUs have more core? compiling (often more than 1 file at a time) seems embarrassingly parallel ; not sure about db transactions

tbaldridge15:04:41

Just looked at some benchmarks, it seems the A11 (iPhoneX CPU) is on the same level as a low end i3. So not that far off I guess. But there'd have to be some reason for people to switch. Smaller laptop designs is a good starting spot I guess.

tbaldridge15:04:48

But it'd probably be the final straw for me to ditch apples for dev work. Since I already have problems writing code in OS X and deploying to Linux, adding a CPU instruction set switch into the mix is probably not worth it.

seancorfield15:04:10

Apple's moves over the last few years have me switching to Windows 10. Especially now Ubuntu etc can run in WSL.

seancorfield15:04:35

My main dev machine is a 2012 27" iMac i7 with 16GB RAM and a 256GB SSD HD -- but I run Windows 10 in Parallels Desktop for all of my non-dev stuff and use Terminal on the Mac side for dev stuff. The next machine will probably be a Surface Book 2 at this point.

andy.fingerhut15:04:06

Maybe those stories missed the April 1 "news" cycle? 🙂

pesterhazy15:04:10

Programming workload is constrained mainly by single-threaded performance, no? Where Intel will probably still be king for a while...

sveri15:04:12

Anyone managed to share the windows user folder with the W10 ubuntu folders?

justinlee15:04:14

i’m going to have to start seeing “ohhh, you’re using windows!” less often on github issues before i consider giving ms another chance

roberto15:04:26

I want more RAM over more powerful CPU. The issues I run into mostly tend to be related to RAM usage.

seancorfield16:04:22

@lee.justin.m I do all my Clojure dev in WSL on my laptop. Having that facility is why I can finally move to Windows (after using Apple machines for 25 years).

justinlee16:04:38

@seancorfield and it acts like a real unix with a well-behaved filesystem?

tbaldridge16:04:36

@lee.justin.m bunch of info here: https://blogs.msdn.microsoft.com/commandline/learn-about-windows-console-and-windows-subsystem-for-linux-wsl/ But it works the same way WINE does, it wraps the Windows kernel with Linux APIs. So linux binaries think they're running on a version of linux.

tbaldridge16:04:24

Pretty cool idea, WINE mostly-works, but has flaws due to there being so many undocumented Windows APIs and complex tech, but it seems like duplicating an OSS interface would be much simpler.

jgh16:04:49

i guess for the reasons you mention it’s easier for MS to make something like that than for the wine team

dpsutton16:04:23

reee-ify or ray-ify? how do you pronounce it?

tbaldridge16:04:05

huh, I just looked it up, it seems that it's ree-fy, I pronounce it ree-i-fy.

pesterhazy16:04:51

http://dictionary.com has ree-uh-fahy, which sound right to this non-native speaker

tbaldridge16:04:37

yeah, I was tripped up by google's definition "ˈrēəˌfī"

fellshard16:04:48

Good ol' schwa

4
tbaldridge16:04:01

but I guess that does match what @pesterhazy found

fellshard16:04:03

"Just kinda munge a vowel here"

tbaldridge16:04:18

English needs a -h option

😂 16
dpsutton16:04:18

i was gonna put a reaction on that but all of the laughing ones are a bit over the top. like i feel bad using them if i'm not crying tears of laughter

fellshard16:04:48

I believe they are tears of pain in this case.

seancorfield17:04:38

@lee.justin.m You can download Ubuntu and a few other distros directly from the Windows Store and they run as-is on WSL. And they're actual user mode distros, as far as I understand it.

seancorfield17:04:50

You install stuff with sudo apt-get install ... and everything behaves just like regular Ubuntu. The Windows C: drive is /mnt/c.

fellshard17:04:48

I've used it successfully to do standard development on, even installing parallel versions of Ruby and Node

fellshard17:04:47

once or twice I've had aliasing issues where commands eval'd to Windows PATH targets, but for the most part that was just an issue of refreshing environment after an install.

fellshard17:04:20

Teammate uses a Mac, so he was writing shell scripts, and this let me use it flawlessly

seancorfield17:04:08

Yeah, our target env is Linux (Red Hat/CentOS) and our dev envs have historically been Macs but one dev uses Linux and with WSL I'm able to run our stack on Windows.

fellshard17:04:32

It's a pleasant surprise that they got something that right

tbaldridge17:04:10

MS has changed a lot since they got a new CEO a few years back. The language of the company went from "everyone should use Windows!" to "everyone should be able to use MS software".

tbaldridge17:04:57

That and open sourcing .NET changed my views of them quite a bit.

fellshard17:04:59

It's a relative relief compared to the competing walled garden.

4
fellshard17:04:05

Like most major tech companies, I think, they've had a mix of brilliant and horrid ideas. - Their researchers are top-tier, but that research rarely makes it to light. (Shed a tear for Midori...) - They share a great portion of responsibility for software of the '90s leaping off the complexity cliff, but are making efforts to tidy up the consequences to some degree. - Azure is a bonafide mess, with documentation that rivals the worst of MSDN, and a strategy that boils down to 'lift and shift, but worse'. I'm still waiting for the upside for this one...

tbaldridge17:04:36

I agree, I think were MS has excelled the most is when they cut the red tape and go do their own thing. DirectX murdered OpenGL mostly because it could get new features enabled in months instead of years, and because they didn't have to care about how some standard was going to work on SGI/SUN/whatever hardware

☝️ 4
tbaldridge17:04:28

CLR was the same way, don't worry about backwards compatability, just go write your own VM that's "good enough" but because of stuff like value types, great C interop, and SIMD can beat the pants off of the JVM in some situations.

tbaldridge17:04:55

C# vs Java for the same reasons, they had lambdas 5 years before Java?

tbaldridge17:04:07

While companies are still figuring out how to get Vulkan working everywhere, DirectX 12 is already out and gives performance on par with Vulkan.

tbaldridge17:04:13

And the crazy stuff they've done recently, like putting MSSQL on a Linux vm and shipping Docker containers of it, is just icing on the cake

roberto18:04:18

The language of the company went from "everyone should use Windows!" to "everyone should be able to use MS software". This still hasn’t been a pleasant experience for me.

roberto18:04:51

Every year I give F# a shot in a Mac, and it is so painful to do anything practical with it.

roberto18:04:38

On the other hand, I am a vscode convert now and use daily on my mac.

tbaldridge18:04:17

F# has always been a second-class citizen. Even on Windows

tbaldridge18:04:31

C# on mac is pretty cool though. And they did stuff like port full Office to Mac

fellshard18:04:03

Yeah. They've never invested in its tooling, and it's never worked anywhere I've tried it.

fellshard18:04:26

Mac Office is also... still buggy, though at least they're trying

fellshard18:04:54

The direction's better at least.

justinlee18:04:28

well that’s all super interesting. are there any laptops with mac-level build quality? i’m more than happy to pay for premium hardware, but last time i looked, everything was plastic garbage

seancorfield22:04:39

@lee.justin.m Have you looked at the Microsoft Surface line? One of my colleagues has a Surface Book (1st ed) and it's beautiful -- the new Surface Book 2 is even more gorgeous.

seancorfield22:04:11

As others have said, Dell is pretty solid -- I've had several over the years that have lasted really well. Even the old plastic ones were very well built. I have an XPS 12 (convertible) that's a bit long in the tooth but still runs beautifully after being carried all over the world and dropped and used as a drink coaster etc. I'm very hard on laptops!

seancorfield22:04:20

As for Mac-quality, I've been increasingly disappointed with that over the last ten years. I've had several screen and HD failures recently -- and that was unheard of years ago. I definitely will not buy another Mac (and I've been an Apple user for 25 years!).

justinlee22:04:27

@seancorfield Thanks. I’m just so scarred from corporate-issue laptops that creak and squeak and have bad monitors. Or that don’t sleep/wake properly or recognize devices in a timely fashion. Or fail to connect to the wifi. I have thought about the surface. It’s a nice looking machine and I trust MS to spend more attention to detail than your average OEM. Apple is irritating, but on the other hand I have a 2012 era laptop that is serving me well. I had to get it serviced once (bad screen), but it was flat rate and handled with typical Apple level of service, which meant they replaced other stuff I didn’t ask them to because it failed their diagnostics (got a new battery for free). All flat rate.

justinlee22:04:41

I’m also a guy who simply appreciates the aesthetics and general all around good taste of apple

seancorfield22:04:04

Yeah, like I say, 25 year veteran of Apple products but lately they've really lost their edge and we've had less-than-stellar experiences with Apple service techs too. We have a 2009 iMac with a screen that randomly switches off and it's been into Apple multiple times -- they've replaced all sorts of parts (including the motherboard!) and they still can't fix it. My last MBP became pretty much a brick due to screen failures. And their model updates since 2012 have been totally underwhelming.

seancorfield22:04:59

The Surface line from MS is just breathtaking. I literally started to drool the first time I got my hands on a Surface Book and the massive Surface Studio left me speechless 🙂

justinlee22:04:47

Yea that’s disappointing and seems consistent with the general view of the world. I just haven’t been excited about non apple stuff in a long time, but maybe I should take a look at the surface

seancorfield22:04:47

I run Windows 10 Pro on my iMac although, for reasons, I still do my dev work on the Mac side with Terminal and Atom/ProtoREPL.

seancorfield22:04:11

For me, the turning point was touch screens. My XPS 12 is a touch screen and I love it. I am constantly frustrated that my iMac is not. And Apple have made it clear they have zero plans for a touch screen on a computer.

justinlee22:04:42

now that is surprising!

seancorfield22:04:04

When pushed recently about the issue, they specifically said their view is that people who want touch functionality should buy an iPad Pro and use it as an external touch screen for their main Mac desktop!!! 👀

justinlee22:04:15

Well to be honest, that sounds about right. I was surprised because I basically never want to touch my laptop, but maybe I just haven’t experienced it.

justinlee22:04:47

In fact, people who point at my screen and smudge it typically get smacked 🙂

souenzzo22:04:41

@lee.justin.m why not thinkpad? X has awesome models and T has good prices.

justinlee22:04:18

do they still have that goddamn red rubber nipple in the middle of the keyboard?

souenzzo22:04:08

Yep. But its a thin carbon notebook with touchscreen and exchangeable parts

seancorfield23:04:45

Are ThinkPads still solid now they're built by Lenovo in China instead of IBM?

seancorfield23:04:08

(someone was just asking my opinion of the ThinkPad T470 and I didn't know what to tell them)

souenzzo23:04:59

Thinkpad X and T still ok. Other thinkpad series are also "good as a DELL". IdeaPad and others are just regular notebooks

✔️ 4
pablore14:04:39

Have you looked at System76 laptops?

justinlee15:04:13

I actually need to use office on a regular basis

jmckitrick18:04:06

This makes me nervous as well. I went Win95->Linux->BSD->OSX and can’t imagine giving up the look-and-feel of my Retina MBP with Unix under the hood.

jmckitrick18:04:15

But maybe that will change….

tbaldridge18:04:26

Even that's gone downhill for me lately. My 2017 MBP overheats constantly, can't deal with hot-swapping displays very well and is limited to 16GB of RAM

tbaldridge18:04:14

but most of those are software problems I guess

michaels18:04:58

I think every mac ever has overheated constantly.

michaels18:04:16

It’s the age old thing of it’s not aesthetically nice to have room for/listen to fans.

mpenet18:04:44

Dell xps line is very decent

☝️ 16
akiroz18:04:58

I honestly don't understand why everyone hates fans... I have a couple of rack servers in my bedroom running 24/7 and the noise feels rather calming.

fellshard18:04:44

There's fans running at constant hums, and then there's fans that oscillate between silent and jet plane taking off. That is the MBP experience.

☝️ 4
fellshard18:04:13

Variable load -> noticeable fans instead of mere background noise

fellshard18:04:35

Probably also depends on the fan drivers and how fussy they are about state changes

sveri19:04:42

@justinlee we use the dell latitude line at work, cannot complain. But I never felt the need for that bling bling anyway. 1920x1080 resolution + 2 extra displays + an extra keyboard and mouse (aka dockingstation) is enough for me. On my machine (16 GB, i5) I can run two instances of eclipse + like 5-7 servers (all java of course and usually something built on top of tomcat or jetty). If its needed I can also fire up YourKit additionally and start profiling.

sveri19:04:06

Overheating is only a problem whenever that shit thing of McAfee starts running, which we have to have installed, how I hate that.

sveri19:04:22

Of course we still have viruses and trojaners inside our company network.

sveri19:04:46

Because McAfee wont keep employers from opening that shiny new email that Jeff, the CEO from <mailto:[email protected]|[email protected]> sent 😄

fellshard19:04:45

hello yes i am ur new ceo, pls send credit card to mak sure it is secur

borkdude20:04:36

Rich mentioned JVM vs CLR in his latest talk. JVM was set top boxes/dynamic where CLR was static technology. How accurate is that?

Alex Miller (Clojure team)20:04:39

the JVM is very dynamic (and type erasure was a fork in the road as well). the CLR is more static (and does not do type erasure afaik)

bronsa20:04:39

yeah it doesn't

bronsa20:04:36

which intuitively one might think it makes the CLR a 'better' vm, in practice it makes implementing languages with different type systems than the underlying vm (such as clojure) much harder

Alex Miller (Clojure team)20:04:40

yeah, instead they went the other way and made DLR on top of CLR for dynamic stuff :)

tbaldridge20:04:54

CLR has stuff like dynamic though that removes the need for a lot of the reflection logic

tbaldridge20:04:30

I think you could have a lisp like Clojure that ran quite well on the CLR, but it would require working with the VM in some specific ways and making the compiler more complex

schmee20:04:47

isn’t there already a CLR port of Clojure?

tbaldridge20:04:30

Yes, but it's a port of Clojure on the JVM and the two platforms are quite different.

tbaldridge20:04:36

For example generics are a thing on the CLR

tbaldridge20:04:27

So in Clojure on the JVM you have the whole invokePrim thing, but that could all be reduced to a single generic interface, and expanded on-the-fly

tbaldridge20:04:39

Which the CLR includes by default

tbaldridge20:04:15

But the CLR doesn't have runtime profiling, so that puts more pressure on the compiler to write efficient code, and to do inlining on its own.

schmee20:04:14

no free lunches to be found 🙂

schmee20:04:42

compilers and jits is such a deep and fascinating area, I’ve barely scratched the surface and I’m completely hooked 😄

tbaldridge20:04:07

That's what I loved about the CLR, it's way less magic than you would think. It doesn't have a warmup time at all. It goes straight from bytecode to machine code once. You can even pre-compile bytecode and cache it. The GC is really light, a GUI app in C# often uses < 10MB ram. and the C interop is pretty awesome.

schmee21:04:04

what’s your take on Graal/Truffle?

schmee21:04:19

I just got my new computer setup going so I can finally dive into it for real

tbaldridge21:04:05

I finally got time to look into it recently. It's pretty cool tech. A bit strange as it involves a lot of boiler-plate code, and they try to reduce that with code generation and DSLs, and it's all quite undocumented.

tbaldridge21:04:53

But it's a cool idea, you execute an AST, an throw exceptions when an assumption about the code doesn't hold, and then de-optimize. Once the AST stops changing it's compiled to a single method/code block.

tbaldridge21:04:23

Still a bit memory heavy though. Ruby in C uses about 10MB by default, Truffle-Ruby is about 170MB

schmee21:04:39

do you think it’s viable to implement Clojure with Truffle?

schmee21:04:47

I’ve been thinking about automatic primitive specialization in Clojure, if that it even possible

schmee21:04:01

seems like the kind of thing Truffle is really well suited for

borkdude21:04:23

the idea is spreading

borkdude21:04:42

(sorry for going off topic, but that’s what this channel is for right)

tbaldridge21:04:02

@schmee yeah, I think it would work quite well. But it would mean a complete rewrite of most of clojure.lang.* Especially RT.java.

tbaldridge21:04:22

Every method overload in RT would expand into its own class, with logic to switch between the impls.

tbaldridge21:04:34

Thats what made me stop digging into it more. Truffle is just so verbose. And since Truffle uses abstract classes and annotations, writing such a thing in Clojure is not possible. Unless of-course you start with modifying Clojure 😄

schmee21:04:04

A Clojure DSL to write Truffle to write Clojue, I love it! 😄

Alex Miller (Clojure team)21:04:12

doesn’t all compiler work start with writing a new compiler? :)

schmee21:04:00

> And since Truffle uses abstract classes and annotations I don’t understand why this is a problem though. Is it because Clojure constructs already inherit from something else?

tbaldridge21:04:35

No, correct me here @alexmiller what's the best workflow for doing a lot of genclass. Is that even possible in the REPL, or do you have to restart the JVM? It's been so long.

Alex Miller (Clojure team)21:04:29

the best workflow is to write a lot of code, then compile it, and hope it was all right

schmee21:04:53

if https://dev.clojure.org/jira/browse/CLJ-2343 gets merged it should work in the REPL as well, right?

tbaldridge21:04:29

should. and yeah, I got him to create that patch when I was playing around with Truffle 😄

tbaldridge21:04:36

Never got around to trying to hook it all up though

tbaldridge21:04:28

heh, nvm, created last Friday?

schmee21:04:50

so the “plan” is to use genclass + macros to generate the Truffle boilerplate?

tbaldridge21:04:16

Right, and to somehow build a DSL for it, since you'd have to be really careful not to pull in a lot of Clojure code in the process.

bronsa21:04:17

you're thinking of the defclass patch @tbaldridge

tbaldridge21:04:21

So it would probably involve a lot of definterface as well so you could get proper typing of the arguments

schmee21:04:33

I really, really like the idea of Clojure in Truffle in Clojure

bronsa21:04:47

there we go, this dude

bronsa21:04:13

(props to @cfleming for this patch, he paid for the development and was kind enough to allow for open sourcing it)

tbaldridge21:04:16

yeah, defclass would work as well as long as it supports annotations

schmee21:04:55

@bronsa does that patch work on master?

bronsa21:04:01

I think so

bronsa21:04:06

should be super easy to rebase if not

bronsa21:04:12

I rebased it not too long ago

tbaldridge21:04:16

But it would be a fun project, get the framework up and running, then just do a straight port of Truffle's SimpleLanguage to the framework

bronsa21:04:45

yep truffleclojure would be fun, I wouldn't mind helping out from time to time if somebody wants to tackle it and drive the main development

cfleming21:04:55

Also thanks to @bronsa for actually writing the patch, that thing has saved my sanity

bronsa21:04:24

it should support annotations, as it builds on the deftype/reify codebase and IIRC they do

schmee21:04:25

I am for 100% sure going to give it my best shot!

cfleming21:04:29

In case anyone worries about stability, everyone using Cursive has been running it for a couple of years now.

🎉 8
bronsa21:04:31

but I can't remember off the top of my head

cfleming21:04:28

This is linked in the JIRA, but the original full rationale is here: https://docs.google.com/document/d/1OcewjSpxmeFRQ3TizcaRRwlV34T8wl4wVED138FHFFE/edit

schmee21:04:12

@cfleming can you point to an example of where this is used in the Cursive code?

cfleming21:04:32

@schmee No, because Cursive is closed source 🙂

cfleming21:04:42

But I can dig up an example or two, one sec

Alex Miller (Clojure team)21:04:43

why don’t you open source it?

simple_smile 4
cfleming21:04:07

That said, I have actually considered it

Alex Miller (Clojure team)21:04:17

code is only good if it’s open source

cfleming21:04:19

But that’s getting way off topic

Alex Miller (Clojure team)21:04:44

closed source code is a sin

Alex Miller (Clojure team)21:04:13

sorry, I might be getting punchy at the end of the day

bronsa21:04:50

people that complain about shit being closed source probably are not struggling have never struggled to make a living

cfleming21:04:13

(extend-class JPanel []
  (paintComponent [this g]
    (.paintComponent ^JPanel this ^Graphics g)
    (.paint status-text this g)))

schmee21:04:22

@cfleming ahh, my apologies, I didn’t know it wasn’t open source! I did not mean to start a discussion about open vs closed source 🙂

schmee21:04:46

ahh, well, that looks just about as compact as it can get :thumbsup:

cfleming21:04:48

Hehe, I don’t think there’s a real discussion about it taking place, it’s more ironic commentary 🙂

cfleming21:04:06

Yeah, extend-class can be trivially converted from proxy usages

cfleming21:04:48

And defclass:

(defclass ClojureParagraphFillHandler []
  :load-ns true
  ParagraphFillHandler []
  (isAvailableForElement [_ element]
    (boolean (psi/string? (if (psi/leaf? element) (psi/parent element) element))))
  (isAvailableForFile [_ psiFile]
    (instance? ClojureFile psiFile))
  (performOnElement [this element editor]
    (fill-paragraph element editor)))

bronsa21:04:39

one day I'll rewrite the backend to be a library instead of relying on Compiler.java

schmee21:04:41

well, I know what I’m spending my evenings/weekends with for the foreseeable future 😄

bronsa21:04:16

unless @schmee wants to practice his clojure compiler/jvm bytecode skills before starting truffleclojure ;)

schmee21:04:42

believe me, I need all the practice I can get 😅

cfleming21:04:45

There’s one thing that has been tricky with this, which may or may not be a problem for those using it.

schmee21:04:02

I’m in so far over my head here it’s not even funny, but that tends to be a good way to learn lots of things fast

cfleming21:04:08

Clojure is annoyingly inflexible about which classloader it uses to load code.

bronsa21:04:57

@schmee I think I've said it before but I really like the enthusiasm you're putting into this so feel free to ping me anytime if you want to ask something

cfleming21:04:59

In particular, if your classes are loaded outside your control (e.g. from an IoC container, which is my case) you’re probably SOL

bronsa21:04:12

there's not enough clojure compiler hackers out here

bronsa21:04:50

@cfleming would you solve this on a single-class loading basis or at a different granularity?

schmee21:04:57

@bronsa thanks, I really appreciate it 🙂 your help as been invaluable in understanding the compiler and the JVM in general, so hats off to you good sir

cfleming21:04:14

My plan was very hacky - to modify RT.baseLoader() to check a global static var or atom before doing the usual checks.

cfleming21:04:33

Then I can set that to my plugin classloader at app start and just not worry about it.

cfleming21:04:02

I can’t control the TCCL, and dynamic vars are thread local.

cfleming21:04:05

So I’ll just have a public static volatile ClassLoader clojureLoader = null; or something similar which I’ll set when my plugin is loaded.

bronsa21:04:46

hmm yeah not many other ways around it I guess

bronsa21:04:55

I wonder if there's some hacky way using a tagged literal

cfleming21:04:16

Meh - I don’t need a general solution, this is just in a private fork anyway

cfleming21:04:18

While I’m updating the fork I’ll have to work out whether to move to 1.9 or not.

schmee21:04:17

noob question: why is it important to be able to control the classloader?

bronsa21:04:05

no, it's for dealing with stuff like redefinition/reloading/dynamic loading

cfleming21:04:46

In my case, it’s when using :load-ns true - that fails if the classloader is incorrect

bronsa21:04:56

ah interesting

bronsa21:04:05

I wonder if you have a small isolated repro

bronsa21:04:07

no worries if not

cfleming21:04:21

So this is when you have a class which calls other functions from the namespace in which it’s defined.

cfleming21:04:58

That option will load the ns in the class’s static init, but if the classloader is incorrect it can’t find the ns to load.

bronsa21:04:16

interesting

bronsa21:04:26

I wonder if changing the emitted bytecode could help

bronsa21:04:45

routing loading via a more generic RT.loadwhatever

cfleming21:04:52

@bronsa I don’t, but it’s trivial to repro - just load a class defined like that from a classloader without access to the right classpath.

cfleming21:04:19

The issue is that then I’ll get multiple copies of the code loaded, depending on the classloader used to load each class.

bronsa21:04:25

I forgot how :load-ns works :)

cfleming21:04:40

A better solution is just to make sure the loader is correct IMO

bronsa21:04:42

right I see

cfleming21:04:59

Which is annoying but not hard.

cfleming21:04:06

In my case, at least

bronsa21:04:33

yeah I see, you're right, a workaround is likely a hacky non-solution

cfleming21:04:44

I think so, at least in my case where I want everything loaded via the plugin’s classloader. I’m actually not sure what the implications would be in a more general case of loading code into various different classloaders. It sounds like it would end badly, but I don’t have a specific example of why 🙂

cfleming21:04:06

I have to head out, back in a bit

schmee21:04:51

thanks everyone for the great input, much appreciated! 🙏

dominicm22:04:50

https://docs.gradle.org/current/userguide/multi_project_builds.html Is there any feedback from gradle users on how multi project builds work? I want this feature for myself.

seancorfield22:04:39

@lee.justin.m Have you looked at the Microsoft Surface line? One of my colleagues has a Surface Book (1st ed) and it's beautiful -- the new Surface Book 2 is even more gorgeous.

tbaldridge22:04:18

On the downside, there goes my free time

bronsa22:04:42

that was quick

schmee22:04:56

it’s happening

tbaldridge22:04:42

So the next step is to try and port a simple language of some sort and see where the duplicated code is that could be removed via a dsl

schmee22:04:13

@tbaldridge if you do spend time on this, please, let me know what you’re up to somehow (github or something else)! 🙂

tbaldridge22:04:41

It's a lisp so it's pretty easy to port

schmee22:04:08

haha the race is on 😂

schmee22:04:31

let’s have it it for a while and if it seems that something might come out of it we can maybe make a joint effort 🙂

bronsa22:04:18

I'm sure @ghadi will have something interesting to say about it too

tbaldridge22:04:40

for sure, we've talked about doing this for awhile, but the whole gen-class stuff was always a turnoff

ghadi22:04:12

the challenge with truffle is reify

ghadi22:04:46

At least a year ago there was a challenge with entering and exiting the Truffle/Graal interpreter at reify boundaries

ghadi22:04:11

A reified impl of something would call into Truffle .invoke

ghadi22:04:04

But the whole power of Clojure is being able to seamlessly invoke java, and vice versa

ghadi22:04:28

startup time will be far worse on Truffle

ghadi22:04:47

But potentially far higher peak performance

ghadi22:04:25

SubstrateVM isn't a good option for Clojure, because of dynamic loading being incompatible philosophically

tbaldridge22:04:36

not sure I agree there

tbaldridge22:04:49

substrate isn't static, the runtime is

ghadi22:04:04

Otherwise if you had a clojure-like language with less dynamicity, SubstrateVM could work

tbaldridge22:04:08

so all the stuff in core, rt, etc would be frozen, but everything else could be dynamic

ghadi22:04:38

Maybe? It would be a great challenge and I wouldn't discourage anyone

tbaldridge22:04:28

They did it with ruby and are faster than Rubinius (sp?) (Ruby on LLVM).

ghadi22:04:47

the reify boundary thing is real... Need to be able to reify something and pass it to java

ghadi22:04:15

So the reify interface impl would have little stubs that call the Root Node of the Truffle AST

ghadi22:04:27

In order to be able to interop with Java libs

ghadi22:04:23

Chris Seaton and Thomas wuerthinger are good people to talk to

4
schmee22:04:28

is there prebaked support in Truffle for calling into Java/loading classes?

schmee22:04:39

or even load bytecode

cfleming22:04:03

@dominicm I use multi-project builds with Gradle, they’re schweet

cfleming22:04:32

@tbaldridge Does that patch go cleanly onto 1.9?

cfleming23:04:26

(I assume so, since you were back in 5 minutes with working code 🙂 )

tbaldridge23:04:42

yeah, I patched master, used both patches actually

bronsa23:04:34

ah yeah I rebased it 4 months ago and latest commit on Compiler.java was 7 months ago

cfleming23:04:03

Awesome, thanks for doing that @bronsa

cfleming23:04:36

That patch also touches some tests IIRC but I guess they haven’t changed.

Alex Miller (Clojure team)23:04:44

Compiler is perfect, we’re done with it.

cfleming23:04:14

We’ll all be using TruffleClojure by next week anyway by the look of it

trollface 4
cfleming23:04:03

@schmee This is totally self-interested, but if you’re interested in a compiler project that would actually get used, brushing up tools.emitter.jvm would be awesome.

cfleming23:04:23

AFAIK that would mean that we’d have a hackable Clojure compiler.

bronsa23:04:28

I actually had plans to do that

bronsa23:04:53

I contacted the insn author a few months ago about getting insn into contrib & switching t.e.jvm over to it

cfleming23:04:04

Yeah, that looked really nice

bronsa23:04:06

unfortunately I still haven't had time

bronsa23:04:30

so if anybody wants to help there

cfleming23:04:40

But I would absolutely use that. That would mean that defclass/extend-class could just be macros, I guess?

bronsa23:04:52

otherwise it's likely still going to happen, just at my current slow pace

schmee23:04:11

@cfleming what kind of brushing up does it need?

cfleming23:04:36

@schmee @bronsa is your man for all questions, just let me know when you’re done 🙂

cfleming23:04:55

IIRC implementing the built-in forms?

bronsa23:04:54

there's a ton of work to do: - making sure it all runs using the latest t.a.jvm backend - work on supporting AOT - implement all the compiler enhancements of the past 4 years - move t.e.jvm from the shitty ad-hoc symbolic bytecode I wrote to insn as a first

cfleming23:04:04

@bronsa Let me know if this is a crazy idea, but once you have something like insn, it seems like macroexpansion could even bottom out at the bytecode data structures, so even things like if could be macros. Is that possible/desirable?

cfleming23:04:45

Then literally the whole language is totally hackable.

bronsa23:04:00

some special forms could be macros I guess, but there might be bootstrapping issues I've never thought about it

cfleming23:04:21

I guess there are probably analysis phases you want to run at certain points too.

bronsa23:04:43

but -- if your idea is making if macroexpand into emitting bytecode, well

bronsa23:04:53

that won't work too well

cfleming23:04:15

Not actually emitting, but just ending up with the symbolic bytecode structures.

bronsa23:04:28

yeah sure I guess

bronsa23:04:42

i'm not sure how much value that would have

bronsa23:04:59

with the t.a/t.e architecture the whole language is already extensible/hackable anyway

cfleming23:04:04

Me either, really

bronsa23:04:18

esp if we take the mage/magic lesson and incorporate it back into t.e.jvm

cfleming23:04:36

Which is more or less insn, right?

bronsa23:04:40

I wish I had another year to work on this stuff

cfleming23:04:50

Me too 🙂

schmee23:04:08

mage/magic lession?

bronsa23:04:24

@cfleming no, what i'm talking about is their emitter architecture

bronsa23:04:00

I don't remember what nasser called it, but he architectured it so that the emitter would have a context map of special form -> emit-fn

bronsa23:04:32

which he parametrizes walking the AST to implement certain peephole optimizations

cfleming23:04:02

Nice, I hadn’t seen that bit - I vaguely remember the context map thing

bronsa23:04:09

insn is essentially the shitty dsl that t.e.jvm has but done right and consistent

bronsa23:04:33

but we were already doing symbolic bytecode

bronsa23:04:37

from the start

cfleming23:04:41

Yes, I remember that bit

bronsa23:04:09

I regret using syntax-quote as a templating language for bytecode

bronsa23:04:25

it made bad ideas too easy to implement