other-languages

emccue 2022-01-03T00:00:14.195800Z

which is frustrating because i actually really like where the language is heading

emccue 2022-01-03T00:01:09.197200Z

which to the original thing i was gonna talk about - patterns like this are now representable

:conflict-handlers - map of string pattern (regex) to built-in handlers,
                       symbols to eval, or function instances

emccue 2022-01-03T00:02:55.199300Z

public sealed interface ConflictHandler {
    record Ignore() implements ConflictHandler {
    }
    record Overwrite() implements ConflictHandler {
    }
    record Append() implements ConflictHandler {
    }
    record AppendDedupe() implements ConflictHandler {
    }
    record Warn() implements ConflictHandler {
    }
    record Error() implements ConflictHandler {
    }

    non-sealed interface UserDefined extends ConflictHandler {
        ConflictResolution resolve(
                ConflictInformation conflictInformation
        );
    }
}

seancorfield 2022-01-03T00:03:14.199800Z

One problem with a language that is so incredibly widespread and mainstream is that it is really hard to form any sort of coherent "community" -- there can be localized communities, either geographically, or by domain. There's no one-size-fits-all.

emccue 2022-01-03T00:03:32.199900Z

is a decent translation of

Available built-in conflict handlers:
  :ignore - don't do anything (default)
  :overwrite - overwrite (replaces prior file)
  :append - append the file with a blank line separator
  :append-dedupe - append the file but dedupe appended sections
  :data-readers - merge data_readers.clj
  :warn - print a warning
  :error - throw an error

+  a function instance

emccue 2022-01-03T00:07:36.201200Z

that makes sense, but “the python community” does seem to very much exist

emccue 2022-01-03T00:07:37.201400Z

https://www.python.org/community/

emccue 2022-01-03T00:07:54.202200Z

and they are just as big and about as old

emccue 2022-01-03T00:08:09.202700Z

so i don’t think that is the whole story

seancorfield 2022-01-03T00:08:10.202800Z

Yeah, I attended PyCon in 2013 coz' it was local and I felt so welcome and it was a great conference.

seancorfield 2022-01-03T00:08:27.203600Z

But I've also attended a lot of large Java conferences and they always felt "corporate".

seancorfield 2022-01-03T00:08:40.204100Z

I used to go to JavaOne every year in San Francisco.

emccue 2022-01-03T00:09:28.204800Z

i started programming in python and got most of my “headstart” from watching pycon talks

emccue 2022-01-03T00:09:51.205400Z

I still have that pycon talk about choosing the default colors in matplotlib for medical imaging living rent free in my head

emccue 2022-01-03T00:12:22.206900Z

and from how dev.java and all the other “corporate initiatives” position themselves - it seems like oracle really wants that vibe of community to exist

seancorfield 2022-01-03T00:14:52.209100Z

I started Java back in '97 and parted ways with it after Java 5 some time. But I thought Java 8 was step in the right direction and some nice stuff has been added since -- but I could never go back to programming in Java these days. There are so many options on the JVM now... I could live with Kotlin if I had to. Maybe I could go back to Groovy or Scala if I had to...

emccue 2022-01-03T00:16:12.210100Z

Java is only slightly older than I am, but when i first started to hate it, it was on 6-7

emccue 2022-01-03T00:17:20.210600Z

and when i applied to my first internships in college i was adamant in not wanting to work with java

emccue 2022-01-03T00:19:12.212500Z

but after having to work with it and years of reflection i would prefer the newest java over scala and groovy for almost everything

seancorfield 2022-01-03T00:19:34.213100Z

I was 35 when I learned Java -- are you trying to make me feel even older than usual? 🙂

emccue 2022-01-03T00:20:29.213500Z

yes

emccue 2022-01-03T00:21:57.214700Z

I think its all about framing

emccue 2022-01-03T00:22:59.215900Z

I came back into java after having a haskell loving roommate followed by a scala and rust loving one and being the elm and clojure person

emccue 2022-01-03T00:25:45.217800Z

but without any of the context of how/why other communities do things I would be one of those people copy pasting getter and setter methods on everything still

emccue 2022-01-03T00:26:55.219300Z

and as per usual i don’t know where i was going with that

seancorfield 2022-01-03T00:27:49.220200Z

Yeah, if you go to large Java-focused events and talk to a lot of devs, there's so much of that copypasta code and bashing code out following standard "patterns" without actually understanding any of it...

seancorfield 2022-01-03T00:28:51.221300Z

I remember at one Java conference, there was a talk about continuous integration and I was listening to attendees coming out of it, and they seemed to think it was unattainable academic "magic"...

emccue 2022-01-03T00:36:38.224100Z

anywho my general thought was “what if instead of maven or gradle people wrote this”

public static void main(String[] args) {
        var buildTools = BuildTools.getInstance();

        buildTools.javac(
                List.of("src"),
                "target/classes",
                List.of("-source", "17", "--enable-preview"),
                buildTools.createBasis()
        );
    }

emccue 2022-01-03T00:37:03.224400Z

that would be a lot easier for me to teach

emccue 2022-01-03T00:37:54.224700Z

{:paths ["target/classes"]
 :aliases {:dev {:extra-paths ["src" "build"]}
           :build {:deps        {org.clojure/clojure {:mvn/version "1.10.1"}
                                 io.github.clojure/tools.build {:git/tag "v0.7.4" :git/sha "ac442da"}}
                   :paths ["src" "build"]
                   :ns-default  dev.mccue.jproject.build}}
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        io.github.clojure/tools.build {:git/tag "v0.7.4" :git/sha "ac442da"}}
 :deps/prep-lib {:alias :build
                 :fn    compile
                 :ensure "target/classes"}}

emccue 2022-01-03T00:38:06.225Z

and this is the deps for that project

emccue 2022-01-03T00:38:23.225400Z

the only clojure specific parts are :ns-default and :fn

emccue 2022-01-03T00:39:41.226400Z

there is a bit of a bootstrap issue, but if its one file then java can already launch it like a script

emccue 2022-01-03T00:40:18.227Z

{:paths ["target/classes"]
 :aliases {:dev {:extra-paths ["src" "build"]}
           :build {:deps        {org.clojure/clojure {:mvn/version "1.10.1"}
                                 io.github.clojure/tools.build {:git/tag "v0.7.4" :git/sha "ac442da"}}
                   :paths ["src" "build"]
                   :class-default  "dev.mccue.jproject.build.Build"}}
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        io.github.clojure/tools.build {:git/tag "v0.7.4" :git/sha "ac442da"}}
 :deps/prep-lib {:alias :build
                 :method compile
                 :ensure "target/classes"}}

emccue 2022-01-03T00:42:28.228200Z

i tried to write all of that from scratch months ago and got nowhere

emccue 2022-01-03T00:43:32.229500Z

now i’m thinking just 1. Wrap tools.build 2. Wrap the cli and replace :method and :class-default with something that monkey patches in the functionality for java

emccue 2022-01-03T00:45:18.230400Z

another thing pushing me is the one time a friend’s work moved to interacting with a WSDL api and the way to generate the glue code was a maven plugin

emccue 2022-01-03T00:45:23.230600Z

like - what?

emccue 2022-01-03T00:47:07.232300Z

as obtuse a use case as it is, “prep-able deps” + easy local/git dependencies would have solved it in a really straight forward way

seancorfield 2022-01-03T00:56:36.234100Z

With a wrapped build script, written in Java, don't you just have to first compile it and then run it? That seems a step back from Gradle -- at least that has a relatively-close-to-the-language DSL that you write as a script.

emccue 2022-01-03T00:56:46.234300Z

not if its a single file

emccue 2022-01-03T00:58:20.235Z

and afaik gradle still works with a “lifecycle/plugin” model

emccue 2022-01-03T00:59:56.235500Z

but yeah if you had a complex build program you would have to build that somehow

emccue 2022-01-03T01:00:15.235800Z

probably with a simpler build program

emccue 2022-01-03T01:00:31.236100Z

hence the “bootstrap” issue

seancorfield 2022-01-03T01:01:09.236600Z

Ah, JEP 330. I missed that coming in with Java 11.

emccue 2022-01-03T01:12:15.238200Z

and if gradle or scala or kotlin or clojure works better there is no reason why they couldn’t be used

emccue 2022-01-03T01:12:52.239Z

the central thesis here is just that no abstraction of build lifecycle is better than a lackluster one

emccue 2022-01-03T01:13:25.239500Z

so make builds programs

👍🏻 1