Fork me on GitHub
#off-topic
<
2022-05-30
>
Ben Sless05:05:07

Did you turn on warn of reflection?

Ben Sless05:05:00

And is that with a lein repl or deps?

emccue12:05:00

with deps and I did turn on warn on reflection which is what gets me

emccue12:05:22

i just assume aset does reflection otherwise i dont have an explanation

Ben Sless13:05:28

It does, you need to type hint it

emccue13:05:57

Okay so even with the objects hint still getting this in the bytecode

emccue13:05:04

Reflector.invokeStaticMethod(RT.classForName("clojure.lang.RT"), "aset", new Object[]{const__5.getRawRoot(), RT.intCast(i), const__7});

Ben Sless14:05:09

Where did you put the hint?

emccue14:05:39

(aset ^objects regular-small-array i 10)

Ben Sless15:05:34

Found it, you need to box 10

Ben Sless15:05:03

this is well behaved

(def n 10)

(with-progress-reporting
  (quick-bench
   (doseq [i (range 100)]
     (when (even? i)
       (aset ^objects regular-array i n)))))

Ben Sless15:05:17

And it's faster

Oliver George05:05:56

Free idea: a tool which generates conservative preconditions for a defn form based on how it uses inputs (static analysis of direct use - no consideration for how args passed to other defns might be used).

vemv06:05:09

why statically though? Sounds like best done at runtime (just like with code coverage tools)

Baye14:05:46

Hi. I am curious, what type of programming do you do at your job? Backend for web apps Frontend Mobile Software for systems (planes, cars, IoT devices, etc) ML/Data science Would love to hear about other type of programming/application you are working or that you know other people are working in Clojure

Martynas Maciulevičius14:05:12

I use XTDB and I'm making a database for back-end devs to use. And then I do DB relationship modelling and then I do some system design as in performance improvement or some kind of new query type support (I implement them by hand). It's quite far away from regular DB stuff because some of the things found in SQL DBs simply don't exist here. And I have to... code them... Edit: It's not that I'm trying to make XTDB into ACID SQL DB. In here I have something very different from most systems that I saw in the past.

👍 1
respatialized14:05:06

https://clojure.org/news/2021/04/06/state-of-clojure-2021 you may be interested in last year's State of Clojure survey for a high-level view in addition to whatever experiences people share here. I think we'll get a writeup of this year's results soon as well :pencil:.

👍 3
Baye15:05:15

Hi. If somebody had time to learn one other language in addition to Clojure, what would language would you recommend. Criteria for choice could be better programmer, or complement Clojure to make one more effective in writing apps, etc. Just curious

borkdude15:05:49

ClojureScript :-D

😁 1
delaguardo15:05:37

Java but only basics, try to avoid learning frameworks like Spring 🙂

solf16:05:50

Javascript because... You can't escape it 🤷

3
teodorlu17:05:31

I've been wanting to get more into Rust. Seems to cover Clojure's limitations well.

👍 4
slipset17:05:50

Haskell. I don’t know Haskell at all, but I enjoy getting a peak at the algebraic types in Clojure. Also it’s nice to understand what a nice statically typed language is all about so it’s easier to understand the tradeoffs

👍 4
1
seancorfield17:05:21

I like the Pragmatic Programmer advice of trying to learn a new language every year. Every year is a bit of a stretch, but I generally manage one every couple of years. Haskell is definitely a good suggestion. Prolog and APL are two others that are "different" and make you think about problems in a completely different way. Other languages I've found interesting to learn alongside Clojure -- just for "fun" and to improve my thinking -- in no particular order: Go, Kotlin, Rust, Elm.

👍 2
eggsyntax18:05:00

> Criteria for choice could be better programmer In terms of the former, if you don't care about whether you'll be able to use them in production, I'd consider: Prolog (or learn core.logic in Clojure), Forth, Haskell, some variant of Smalltalk. >> , or complement Clojure to make one more effective in writing apps, etc. For this I think it's useful to learn a language that's much closer to the bare metal -- C, Go, Rust, maybe even assembly.

vemv18:05:22

maybe I've become complacent but haven't learned much (anything?) PL-wise in many years. rich 's stance on mastery (it's easy to google with that word) deeply resonated with me, so I've been happy to master Clojure, in a few dimensions. In practice it has paid off - it's really useful to be able to pick up a variety of projects quickly (which is handy as a contractor, OSS lover, and likely more!), or design new solutions in unsuspected ways.

seancorfield19:05:08

@U45T93RA6 I don't think that stance is at odds with also learning enough of other languages to pick up alternative ways of thinking about problems -- and I think several languages have features that can teach us important lessons about idioms in Clojure. For example, Go's error handling provides good insight into whether to use exceptions in Clojure or structured results containing error/success information (and working with Go's channels etc can help master core.async); Haskell helps focus on separating side effects and pure functions; Kotlin helps us think about nullability, especially around interop. I think even Rust's borrow checker can teach us to think more precisely about lazy sequences and holding onto the head of those... I always view learning other languages as an opportunity to improve mastery of my "home" language.

2
vemv19:05:39

Yeah, these aren't exclusive approaches and of course is up to one to decide what the right balance is

Mno19:05:03

There's a lot of cool languages to learn just for the experience, and there's a lot to recommend just for practical reasons. If you have a goal in mind then we could probably be more specific

Mno19:05:02

I like rust and Lua because they fill in the minor gaps where clojure doesn't fit that well (embedded systems, or low memory things)

babashka 4
Jason19:05:03

I keep thinking I should spend time learning Haskell although I have already mostly made up my mind. What would be a good lisp to spend time on? Elisp is obvious because I use Emacs but maybe something else would be worth it too.

Mno19:05:36

Common lisp and scheme are common ones (people use it for trying to follow along with the SICP book)

Baye19:05:28

I am not sure I understood Rich Hickey's point when it comes to programming practically speaking. Would his point imply: learn programming in the fundamental sense (Data structure, Algorithm, problem solving type of stuff) or does he mean learn one programming language deeply...would love to hear your takes

seancorfield20:05:08

I wish "the entire premise" that he was disagreeing with had been preserved in all those gists and discussions. There's an interesting HN discussion about it https://news.ycombinator.com/item?id=9058437 -- normally I wouldn't recommend HN for much but there's some good back and forth on reconciling some of Norvig's advice with Hickey's advice.

seancorfield20:05:59

I'm very much in the "it's useful to learn multiple languages" camp but I don't mean "you should switch languages every few years". I mean it more in Norvig's sense that having exposure to several different ways of thinking is helpful to improve your specialty and see the "big picture" -- if nothing else, it helps reinforce why Clojure (for example) doesn't do X or does Y differently to <insert other languages>. I've focused on being a backend developer, often close to the database, rather than trying to be a full stack developer, for example. The three main areas I've spent time on that were really challenging were: databases, parsers/compilers, and network stuff, roughly in decreasing order of experience.

dgb2323:05:30

I think the best way to select a new language to learn (to a reasonable degree) is to look for either reach, alien concepts or both. Reach as in it is used in different contexts or domains. Say bash vs C vs JavaScript vs Julia. Alien concepts as in different way of thinking and programming. Say Forth vs APL vs Scheme vs Go. Examples: I'm currently learning Rust, because it has reach into lower level programming and introduces concepts that are alien to me such as affine types. And bash because I never got around to really learning to use and structure it well, but it is so damn practical. Forth is on my list, because I it seems so alien and quite unique.

dgb2323:05:48

Oh and I'm also learning TypeScript, because of practical reasons, but it turns out it is more interesting than I initially thought.

dgb2323:05:07

In terms of breadth vs depth and mastery, I say "learning a new language" as more of a hobby thing. Having fun with it, asking myself questions and exploring it, maybe write some useful or fun little programs. I don't think that does any harm :)

seancorfield02:05:01

@U077BEWNQ Ah, I missed that there was a link to the non-existent comments from that blog and that it was originally from Rich... Thanks.

eggsyntax02:05:31

Yeah, the comments aren't preserved even in the Wayback Machine versions I looked at, but I think it's pretty clearly a response to the original blog post, since eg the bullet points in Rich's 'imagine your proposal recast' section are modified versions of topic headers in the original post.

Max03:05:57

I'll +1 APL, learning it was definitely the most brain-stretching experience I've had in a while

Stuart14:05:34

I would definitely go for a static typed language with a strong type system like Haskell.

borkdude14:05:05

I spent almost a year on Haskell, and unpopular opinion, but I think the time and energy I put into category theory and working through a Haskell book and eventually writing a real Haskell application (which I could write in an hour in Clojure) maybe wasn't worth it

borkdude14:05:25

It's of course hard to measure scientifically what I learned from it and not everything has to be productive

Stuart14:05:49

Do you think you really need to learn the math / theory to be able to understand / work in haskell ?

Stuart14:05:12

I keep wanting to work through Learn You a Haskell, but I think I'd be terrible if I had to learn a lot of theory first

borkdude14:05:29

Yes, you really need to understand the category theory (monads, functors, monad transformers) to be productive in Haskell. If you're just messing around you won't get very far.

Max14:05:01

To add to what borkdude said, I think you don’t necessarily have to understand the theoretical underpinnings of the category theory you’re using in Haskell, but you do have to understand what the functor/applicative/monad abstraction is to understand how to use it, so while you can often get by with an informal (i.e. non-mathematical) definition for those, you do end up touching on some of the underlying mathematical ideas

👍 2
seancorfield17:05:21

Agreed. I have a BSc in Math (w/Comp Sci) that was very traditional from an English university so there was a lot of theoretical math included -- and when I learned Haskell (the first time -- I've "learned" it repeatedly since the early '90s!), I found myself drawing on that math background, even subconsciously. I am always very skeptical when Haskellers claim "Oh, you don't need a category theory background to learn Haskell!"... I think that's glossing over a lot of foundational knowledge 🙂