Fork me on GitHub

What survey is that from? (and were we #1 last year?)


To answer my own Qs: StackOverflow, and no (Rust has been #1 for six years apparently)

👀 3
❤️ 3

And we continue to be the most well-paid on average

❤️ 3

clojure came in 2nd for most loved this year


> 91% of all respondents and 92% of professional developers identify as a man. The United States has the highest percentage of gender minorities (Woman, Non-binary, genderqueer, or gender non-conforming). We have considerable work to do to ensure our platform is inclusive, and our survey is representative of developers everywhere.

☝️ 9
💜 9

That leaped out at me too -- that the US is ahead and still so terribly unequal 😞 And the racial disparity is equally disappointing.


I mean, it shouldn't really surprise us but it's still a very depressing set of statistics.


I wonder what you would consider equal and not depressing.

💯 3

Something that doesn’t look like that?

☝️ 3
Martynas Maciulevičius09:08:40

This is some more extreme data: Women are nurturers and somewhat think more about well-being of communities. It's hard to think about doing crunch when inside you've learned to think primarily about feelings. At least this is what power structures had made them to be. So if this won't change then we have to change coding. And this would mean that you'd have to make programming feeling-based. Then more women would find it natural. I think @deleted-user could be an example here - you help people with small problems and write about that (if I understand it correctly). So it's a community-focused task, not hardcore engineering task. Also the post from @U0VP19K6K is saying the same thing as my video. The ecosystem got harsher in some kind of way and women decided that it's not what they like.


I very much disagree with the above notion. In our last course “coding for designers” at a design school, we had >50% female representation. Our “best” student was a woman. Also my co-lecturer went through his transition / had his comming out, while we prepared for the course. When he was younger, it never even occured to him that coding would be something he likes or even can do. I think this perception is changing, although too slowly. I think we’re missing out on a ton of talented people and they are missing out on the fun and powerful experience of programming, probably because of cultural reasons. Another takeway for me was that being able to program is not an all or nothing type of deal. I think most would benefit if they knew some programming. This was also the stated goal of the course and it worked. For example we had a CEO of a design agency who would really examine all the techniques in kind of explorative/scientific way, for him it was all about understanding and communication. We had designers who would think deeper about how their designs translate to code and what kind of interactivity and animations were possible and a UX architect, who made a nice little project that looked terrible, but had a real purpose to make something easier. So I think all of this has something to do with the perception of what programming is and who programmers are, and breaking those perceiptions can have very positive impacts on people’s lives.


What we value is important, sorry to use your words as examples but consider: “Women are nurturers and somewhat think more about well-being of communities” Someone has to be… how much do we really value mothers vs. business people, teachers vs. lawyers, nurses vs. etc. … who really keeps society functioning? “doing crunch when inside you’ve learned to think primarily about feelings” Why not question why are we doing crunch in the first place? “So if this won’t change” why not? Our society, economy and institutions (both formal and informal) are our creations not laws of physics. These words alone are political (in the broad sense, I’m not merely taking about formal politics), and positioned.

Martynas Maciulevičius10:08:54

@U01EFUL1A8M Also I'd add to my point that one way to make coding more "feeling-based" is what you did -- to mix it with graphic design. Or some other discipline which is not male-dominated. But this doesn't mean that we'll see more women that become system architects and hardcore developers. These women may have a goal to become UX designer or web developer. Which means that it's not back-end development or databases. Alright. Then what's the next step of these 50:50 articles? Women who design microservices? I'm not sure it's possible to achieve this kind of equality.


@U028ART884X Do you think reasonable equality was achieved in law (according to the above graph) by making law more ‘feeling based’?


Tell that to Margaret Hamilton or Barbara Liskov! No, there is nothing inherently gender specific about programming, except culture and cultural perception is the point I was making. These were designers who broke through those preconceptions and benefited greatly from it. Also I don’t think that design is “feeling-based” at all. It is much more about deeply understanding aesthetics and visual communication and training yourself in materialising internal vision. Whether you’re drawn to it or not, while you are trying to find a profession that suits you at a young age, might have much more to do with culture than anything else.

💯 12
Martynas Maciulevičius10:08:54

@U0VP19K6K I'm not advertising to make coding more feeling-based or extract low-code parts for women to use. I only say that it would get more women onboard onto the tech companies ;D Or have kids do it at school, or then literally anybody. HR (why mostly women here huh? add men pls) wishfully asked (edit: were tasked to ask for men) for more IT women, this is how it can be delivered. It may happen as sometimes people really need this kind of work but I'm not saying it should/shouldn't be done. I don't know what specifically @U0VP19K6K meant by "changing law" but well.. for instance economics is somewhat feeling-based and is called social science for a reason. I think you try to tell this same argument about law but I don't have anything to back it up with. Probably economics fits it better. Also I'm not advertising to tell that feelings are good or bad. I'm saying that current thinking of women in the world's society is more on the soft-skills side as they are specialized to be nurturing children. This is what they are being prepared from the childhood. This is how I join together the theories from the graph of @U0VP19K6K and my video from my prev comment. So I don't think it's a good idea to post fake HR postings about equal rights employment. I think those companies should pay taxes if they aren't "equal". That would make it "equal". And those who aren't "equally represented" then would get the taxed money as income. IMO only this would be "equal".

Jon Boone10:08:11

I think part of the issue here is the framing: when you say “hardcore developer” what does that mean to you?


Maybe then ask the same question then for what they term ‘physical sciences’ in the graph above instead of law or economics. Why is computer science the outlier amongst all the fields?


☝️ TBC, I’m not really saying there is an easy solution to issues involving society, economics, institutions at a global scale. I personally am not a fan of prescriptions like HR enforcing quotas or as you say taxing institutions until they achieve some defined notion of equality. I don’t think that complex systems respond to such blunt forces in a way that achieves what we really want to achieve. But there really is too much in this conversation to make it a fruitful slack thread, sorry! 🙂 I’m going to not engage further due to other time constraints.


Part of the problem with all the conversations like this is that "equal" and "equality" really mean different things to different people.


I don’t think it is about inequality. Coding is just statistically not as excited for women as men. From my point of view as someone who live in Europe in US people are too sensitive about equality and overinterpret reality. Conception of equality 50% / 50% on gender and otherwise it is unequal is misunderstanding and very evil.

❤️ 3
👎 3

@deleted-user; agreed, it’s not for woman to fix this.


“Coding is just statistically not as excited for women as men” that seems to me to be exactly “overinterpret[ion of] reality”!


That’s like saying “Starting wars is just statistically more exiting for men as woman”

Martynas Maciulevičius11:08:16

You know what @deleted-user -- we all fked up. And me too. Actually the original posting didn't even talk about gender equality in IT. It talked about inclusiveness of the stackoverflow platform. Also yes, I don't know you. But you help and this is what I saw. So I used this as an example. And I didn't say that you're not something. I didn't do that. Please don't assume opposite things which I didn't say. Also I'm sorry if this had hurt your feelings.


@U0VP19K6K sure, you can not agree. At least this is my observation of reality and people who I know this is true and have nothing to do with gender inequality. There is no point to discuss this further from that moment.


@U0WL6FA77 correlation/causation?


@U0VP19K6K I feel you don’t want to have constructive conversation where all sides can learn something, but you want to use general sentences to win. I am fine with your other opinion, than mine. > There is no point to discuss this further from that moment.


@U0WL6FA77 Apologies for the short reply, what I meant to say was: “Coding is just statistically not as excited for women as men” do you think that is a correlation or is it caused by genetics (causation)?

👍 3

@U0VP19K6K Does it really matter? On the end what really matter are choices which lead you to do what you want to do. I think it is more complicated and it is genetic (we have different brains, muscles etc.) but also dream of who you want to be which is affected by movies, media, parents etc., but it makes your choices and excitement about something what you believe is for you. But honestly I don’t know the answer, I have only observations 🙂 Try of explanation is my act of believe why this is happening 🙂


@deleted-user I agree with you, I said as much further up. @U0WL6FA77 I think it does matter, again as I said further up, our institutions (formal and informal, better and worse) our economies, our societies are our creation. Do we want better?


I don’t quite understand why this problem came to be (the change of rate around the 80's is interesting though) but I know that there are two things that work very well: education and direct human connection. The latter is important, if you can connect with someone who does a particular job, and you respect that person, then you might be motivated to investigate this further. Sharing excitement with others through education and so on works towards that.


Most people are capable of sharing experiences and actually feel through them. It can be shocking and uncomfortable sometimes though, especially if the perspective is completely different.


All of us have observations which we believe. I don’t know why you think your’s are better, than mine. I only said from my observation coding is less exciting for women, than for men and this is true reason why we have more men coding. Everyone have free will and can be responsible for himself and choices. Comparing it to your opinion and trying to prove less women in coding means social inequality and something is wrong and we have to talk about this and change it - well I see it more dangerous even for women.


@U01EFUL1A8M I seem to remember a piece about the downward turn in the 80's as a consequence of the rise of personal computers and that they were seen as something to give (marketed to) boys.


PS I back to other activities, I see too many unnecessary emotions in this conversation.


@U0WL6FA77 yes but why? What makes something exciting for someone is such a complex issue that touches on how men and woman are raised, in the context of culture and society.


…among so many other things


At the university I worked I felt that Data Science in particular did a better job than overall IT in terms of ratio, maybe because it is relatively new and so they could market it better to include women more.


It’s nonsense because it is ideological

💯 3
👍 3
🎯 3
👏 3

I clearly said: > as someone who live in Europe which define my environment. > I said your subjective observations were less valuable because you don’t suffer the same treatments of women and minorities, and these lead you to poor conclusions If so your observation is as poor as mine, because it is as subjective as mine. Then your conclusion is as poor as mine. Then nobody can have opinions and observations. Unless only mine is poor and your is the right one? I feel you think in that way. @deleted-user as someone who fight for freedom of women and can’t accept my freedom of opinion and observation and thinking your is better. And I have to remind I only said “I don’t think it is about inequality. Coding is just statistically not as excited for women as men.” and you fight with me about that last 30 minutes. Well answer yourself what is more harmful pattern in society 🙂 > also where is your damn science for all this gender essentialist “feelings-based” and “coding is statistically more exciting for men than women” and “different brains that don’t work well for programming”? it’s all damn nonsense don’t lose the context. It was the answer for @U0VP19K6K question about genetic. It wasn’t my initiative.


lol, being angry about a problem is more harmful than the problem itself? I guess if you don’t view it as a problem then that seems to be true.


I’m a white man and this thread makes me emotional, imagine what’s it like for a woman?


> being angry about a problem is more harmful than the problem itself 🎯


I’ve taught programming to girls and the shit they put up from other boys is mind boggling and frankly no wonder there’re not more woman in coding


Do you really believe that being angry about an issue is worse than the issue? Mind boggling


@U0VP19K6K I didn’t observe such issue in Europe. At least where I am living and still there is much less women in coding.


I’m in Europe, I’m sure how that matters?


I mean I didn’t observe bad behaviour against women who want to learn coding in my country (at least when I was in school etc.). It matters, because in US people have much different mindset about such issues, than in EU.


And in terms of perspectives and opinions, there are actually people who study this, as Cora said you can explore the research if it interests you. You don’t have to fall down a post modern rabbit hole


But do you realise I only said I have observation coding is less exciting for women, than for men and this is true reason why more men coding. It is not about inequality of gender. Is it sexist for you? Why? What is the point? Where is the issue?


Well, what is the point you’re tying to make with that observation? What are you saying?


> It is not about inequality of gender.


This isn't even remotely surprising


and by gender you mean identity? I’m just checking as you said earlier “…dream of who you want to be which is affected by movies, media, parents etc….”


and its not because women aren't interested


its because they are gatekeep-ed at every step of the way


I have seen it happen at college, where professors structure weed out classes for only people who already know CS


which women and minorities generally won't, because in high school it is actively discouraged by school administration or by their families or by the existing "boys clubs" of CS


a bunch of people who i've tutored switched majors


I will repeat shorty only once: in my country there are no such issues, about boys club and bad behaviour about women who want to coding. At least I didn’t observe them during my education and still women don’t choose to be software developer, because they prefer other activities. So I see this as a proof your hypnotise is wrong. It made me tired, I don’t want to repeat myself. Can we end this discussion here?


you can stop participating if you choose

💯 3

@U0WL6FA77 so you’re saying your perspective is infallible and a true reflection of ‘reality’?


I do, please don’t direct message me and don’t provoke to dialogue. I don’t want to participate 🙂


👋 I won’t

👍 3

"women have feelings and therefore no want code" is some jordan peterson book club nonsense

💯 9
😂 3

@U0VP19K6K I am saying as in math if you can find 1 prove of fail for hypothesis, then it means hypothesis if false.


You’re engaging again 😄


I didn’t want to leave you with thinking my reflection is better 😉


Women got the right to vote in poland in 1918


kwladyka: but you said it is? 🙂


the I do part -> “I do, please don’t direct message me and don’t provoke to dialogue. I don’t want to participate”


“I do” was for “you can stop participating if you choose”


Ah right, I misunderstood


it basically comes down to - you can't explain a large gap without something being intrinsically wrong. Because the gap wasn't bad and then very quickly in the 90s started in a downward trend it is really easy to say that there is nothing intrinsic about women not liking CS that can explain nearly the entirety of it. It has to be structural issues. Whether that is just families telling women to be get into different fields, gatekeeping education, or whatever. Something is wrong. The "well, the difference is explained by an intrinsic reason of their birth" line of thought is the same one racists will use when they don't want to admit there are major structural problems. "They are poor because they are black. black people just intrinsically are poor and commit crimes" which I think is part of why we have such a visceral reaction to it. Its the same kind of thinking that is why some of us haven't talked to our fathers in months. Its the same kind of thinking that fuels far right movements. It is all depressingly connected. You see it as "too much emotions in the conversation" I see this as the same kind of thinking that leads to my uncle defending every murder by police. The same kind of thinking that makes my mother have no clarify "no, I am the doctor not the secretary" on every phone call.

👍 9

I don't want to let it sit

Martynas Maciulevičius13:08:22

They are developers because they are male.

Martynas Maciulevičius13:08:40

They are factory workers because they are male. They are miners because they are male. They are truck drivers because they are male.

👍 3

all equally fucked conclusions, yes


you are stumbling hard into whataboutism - "what about all these other careers that you aren't intimately involved in - where is your explanation here huh?"


women didn't really join the workforce by and large until 1960. Shit is broken


which do you think is more likely - we have reached a natural equilibrium of gender in different occupations, or existing structural systems railroad men and women to certain careers

Martynas Maciulevičius13:08:01

I remembered why I don't like to give opinions, I was roasted a moment ago about it. But I would choose the ->. But I would like some facts in both sides.


Wow, there's quite a dumpster fire of a conversation going on here. The ratio of responses by gender I think correlates highly with the SO statistics. :D I'd rather just not post anything, but I've got a good tip to offer at the end of this post, so into the fire I go. First, "computer" was the name for WOMEN working as highly-technical calculating machines. No emotions. Pure, adrenaline-rushing computing and analyzing at the speed of thought. Second, when the speed of innovation of analog and digital computers picked up, WOMEN were the only ones learning to program them, because it was considered unskilled labor. Third, when WOMEN figured out everything from structured programming to compilers, software started eating the world, and companies started printing money, MEN suddenly realized that programming is now a highly skilled labor that only they are capable of. These are systematic problems that must be understood, power plays that must be blocked, and conveniently rooted false-beliefs that must be overcome. None of this is easy. I suggest everyone not Google for blog posts, but go read some books written by people smarter than us. Here's one I read recently that is a light-read, but may offer you some new insights:

👍 9
❤️ 3

Martynas M: Why do you feel roasted by emccue’s question?

Martynas Maciulevičius13:08:00

@U0VP19K6K No. I'm reluctant to provide opinions because at any moment it could become a minefield again. And intersectionality should go both ways but it doesn't.


Intersectionality? I’m not sure what you’re getting at? That it’s all opinion and everyone’s is as equally valid as anyone else’s and therefore no one has the right to be angry about what one says?

Martynas Maciulevičius13:08:33

Yeah... I think you're great at what you do. If you got offended you surely are.


You seem quite heartfelt 🙂 as many woman have said to me in my life; “it’s a learning moment” 🙂 I couldn’t have said it better than Cora, it’s great to have strong voices in our community. It’s a pity there aren’t more 😉


I know 🙂


hence the “😉

👍 3
Martynas Maciulevičius13:08:39

Is there only one girl in the community @deleted-user? 😮


It’s real shame really, true intersectionality, true solidarity, true equality is not a zero sum game, we all benefit

Martynas Maciulevičius14:08:22

Are you the only woman in here? Or am I wrong?

Martynas Maciulevičius14:08:47

That'd be quite... creepy


I’m not sure what you’re implying if it were even the case… :woman-shrugging:

Martynas Maciulevičius14:08:59

I don't know. I was just wondering whether in clojure it's even a harsher difference. That's it. Not more.

Martynas Maciulevičius14:08:20

It would be nice to see the statistics for each language

Martynas Maciulevičius14:08:31

I bet JS and Web would have more women


I’d guess it’s the same? There may be data, I haven’t looked?

Martynas Maciulevičius14:08:51

*where "more" is an arbitrary term which doesn't mean much


I’m not sure it really matters. When I say true equality I’m not imagining an exact 50:50 ratio… I’m imagining no power imbalances… call me a utopian 😄


…and that goes both ways, men also suffer under patriarchy; that’s not a reason to not do anything about it

Martynas Maciulevičius14:08:00

But if I understand correctly HR term for this thing is "equal opportunity employment". Which means it's not about power relationships with people, it's only about the opportunity to be hired.


okay I think at this point this can be moved to a group DM for whoever wants to


@U0WL6FA77 > I will repeat shorty only once: in my country there are no such issues Aren't you from Poland, a notably conservative country that recently doubled down on its abortion ban? > about boys club and bad behaviour about women who want to coding. At least I didn’t observe them during my education That you don't see it doesn't mean it doesn't exist... the worst tier of men (stalkers, harassers, violent individuals etc) aren't stupid, they will leave little trace of their wrongdoings. Overall I respect your thinking, but figuring out this stuff from first-principles doesn't necessarily work. There are biases and subtle facts in the way.


Maybe it’s best if the conversation was closed? Not sure if anyone can do that on Clojurians?


(i think ive had my fill and we kinda reached a natural end to the initial inciting thoughts)


Yeah, I’m happy to call it quits


@U45T93RA6 please 🙂;cid=C03S1KBA2 > Aren’t you from Poland, a notably conservative country that recently doubled down on its abortion ban? This is the present. Poland sucks at that moment totally in many areas. My education was in the past when situation was different. What do you want to proof by that and why do you use it as argument for the context of the discussion, so if less women in coding means gender issue? BTW the abortion issue is about there is only 1 right god and this god say you can’t do abortion. It has nothing to do about gender. … “That you don’t see it doesn’t mean it doesn’t exist”. Does imply for you “if you see the problem it doesn’t mean it really exist”? > Maybe it’s best if the conversation was closed? Not sure if anyone can do that on Clojurians? Yes please I am really tired of this conversation. It is not too constructive :)

👀 3

ahem Admin here -- this conversation is way, way off-topic for #clojure. Please just stop guys. This thread is awful and it is exemplary of why we have this problem. Some of you here are very close to just being deactivated for the stuff you're posting here. If you don't think what you've posted is problematic then you are part of the problem and the Clojurians community does not tolerate that sort of stuff. No further commentary in this thread or you will be deactivated!

👍 3
💜 9

☝️ TBC, I’m not really saying there is an easy solution to issues involving society, economics, institutions at a global scale. I personally am not a fan of prescriptions like HR enforcing quotas or as you say taxing institutions until they achieve some defined notion of equality. I don’t think that complex systems respond to such blunt forces in a way that achieves what we really want to achieve. But there really is too much in this conversation to make it a fruitful slack thread, sorry! 🙂 I’m going to not engage further due to other time constraints.


Anyone know of any examples in the wild of an authenticated websocket api server in clojure?


I've written one in pedestal but i don't have that code on hand


basically you need to authenticate the user on their initial http request before it is upgraded to a websocket connection


so i would focus your googling on finding how to hook into that step of the process


idk if thats a help though


Thanks, yeah I have the high level idea in my head of how it works, just would be useful to see a working version


this library doesn't do authentication, but here's an function that creates an upgrade handler (where you would want to check auth):


the gist is you'd "close over" the request authentication in some way so you can refer to the auth information on individual messages after the connection is upgraded

🙏 3

Does anyone know what this is called in paredit and what the command in vim paredit is where the cursor is | : (aa | (bb)) becomes (bb)


Raise, at least in Cursive.


In vim, this:

(d/transact (force *conn) {:tx-data |(:creator-schema schema-map)})
(:creator-schema schema-map)
It’s ignoring the curlies


which is not what I want


So either Raise means something else in Vim, or it just works differently. But those two are just different descriptions of the same phenomenon. :)


in Emacs, paredit-raise-sexp does what you describe


Same in Calva. So sounds like the Vim plugin, whatever you're using, is in the wrong here. Or has a different opinion on what "Raise" should mean.


or am I looking in totally the wrong place?


it wasn’t working out so I installed a vim-centric paredit substitute


I used to be a spacemacs person, but spacemacs crashed once a day. Vim has crashed once in a month


Doesn't splice also do it?

Jakub Šťastný17:08:46

Yeah Lispy in Emacs also calls it raise.

Jakub Šťastný17:08:36

@U015KH5ENEM no, splice doesn't delete the expression, only unwraps it as in (red) becomes red AFAIK.


I'm not at a PC right now, but I could do that with either M-r (paredit-raise-sexp), or M-up - if that's not splice, is it raise-backwards, or something?


I'm much better at remembering keybindings than command names 😁


M-up is cljr-splice-sexp-killing-backward, so that's why I was confused


I'd like to get a list of files in the classpath starting with "" so that i can load them using (load ...)... where the files can be in subpaths as well. Not looking to reinvent this.


if you are not looking to reinvent, what precisely is the motivation here? do you mean files or resources? load doesn't want a file it wants a classpath resource. load can take file paths or resource paths but it's usually resource paths.


What do people usually do as a namespace convention for personal projects? I know for companies, the recommendation is reverse DNS such as prefix, but nobody seems to do that for personal projects, and I think I see why. I'm mostly seeing just the name of the projects (e.g., shadow, next.jdbc, integrant, etc). Am I right on that being the trend, or are there many counter-examples out there? (I see com.stuartsierra.component is one)


It is not only for personal projects. Many popular libraries don’t fallow this convention for namespaces.


Even Clojure itself doesn’t fallow this convention


I think it is because we are small community and we don’t have issues about unique ns so far. But it is just my theory 😉


Hmm right, good points


worth to mention clojars force to use reverse DNS for new libraries. So it needs to be net.clojars.kwladyka/consistency {:mvn/version "1.0.0"} but inside library you can still use whatever ns you want. So slowly, slowly maybe we are moving in this direction.


Exactly that ☝️ our projects (even internal) are distributed with a company prefix, but namespaces do not include it


Looking at, we discover: "Most commonly in Clojure [earmuffs are] used to denote dynamic vars, i.e. ones that can change depending on dynamic scope. The earmuffs act as a warning that "here be dragons" and to never assume the state of the var." Seriously? This immutability thing may be out of control. The state of the var, it is safe to assume, is the nearest dynamic binding thereof.

Russell Mull20:08:57

Yes, absolutely seriously. We often end up with cases like this:

(binding [*some-sym* 42]
  (Thread. #(println "value is" *some-sym*))

Russell Mull20:08:51

The earmuffs indicate that *some-sym* does /not/ follow usual lexical scoping rules, so we can expect that this will in fact not print out 42.


what do you mean "the state of the var, it is safe to assume, is the nearest dynamic binding thereof"?


Other example:

(def ^:dynamic *haha* "oops")

(binding [*haha* "ok"]
  (map (fn [_] *haha*) (range 33)))

Russell Mull20:08:39

I've always thought of dynamic scope as being 'stack-based' - each variable binding lives on the stack, and unwinds with the stack. This is incredibly powerful, but it's also very different from lexical scope. It's totally worth spending some naming convention to alert ourselves and each other of this fact.


to expand @U7ZL911B3’s example by showing how it is treacherous

(cmd)user=> (def ^:dynamic *some-sym* 666)
(cmd)user=> (binding [*some-sym* 42]
              (.start (Thread. #(println "value is" *some-sym*))))
user=> value is 666


(this happens in this case because clojure's dynamic bindings are not propagated to the Thread constructor)


Are we saying Clojure ^:dynamic does not work, @U08JKUHA9, or that it does not work as you expect? I feel a Naggum coming on!


these are all examples of it working counterintuitively, but precisely as designed


it is not broken, it's treacherous


Yea in my example it is just lazy evaluation that can make it error-prone, so I think the 'here be dragons' text from the documentation is warranted


another ammendment to above: > The earmuffs indicate that some-sym does /not/ follow usual lexical scoping rules, so we can expect that this will in fact not print out 42. in fact it would be surprising (and mostly coincidence) if it did print 42

Russell Mull22:08:33

Interesting piece of trivia for those that unaware: for a long time dynamic scope was the default for all lisps. (it was only relatively recently that emacs lisp gained lexical scoping) The prevailing opinion at the time was that lexical scope would too slow for practical implementation - one of Scheme's contributions was to demonstrate otherwise.

🤯 3
Russell Mull22:08:09

In a system that is single threaded and eagerly evaluated, it wasn't such a big deal. Sure the declarations were effectively global, but they were more or less well-behaved. But in a language like Clojure that embraces multithreading and where lazy sequences are normal, man it gets crazy.


Dynamic bindings are an insanely powerful and expressive language capability. I remember the day a veteran Lisper showed me I was re-inventing special variables. Badly. I rewrote Cells that night. That results can seem counterintuitive is a slam on our (me included!) intuitions, or rather, our laziness in trying to fly a precise, sophisticated machine by the seat of our pants. [Thanks, @U08JKUHA9, for reminding of another example of power=counterinuitive: lazy sequences. Are they treacherous, @noisesmith? Dragons, Clojure doc author? btw, what is wrong with dragons?] Speaking of the doc author, "never assume the state of a var"? Oh, are mosquitos in my CPU randomly inserting mosquito eggs in my maps? Sorry, that is just unprofessional documentation.


I didn't suggest not using dynamic vars, we all use them constantly. But they are special cases and lead to weird problems when misused.


that documentation reads fine to me. and dynamic vars can be changed at any point in the call stack, regardless of what you might see as an initial binding. it's a good admonition


or in the Thread case, it can look like the call stack propagates a binding where it doesn't


I actually had a tech interview where the poor kid, a new Clojurian, showed me thirty lines of code and said find my bug. I looked for about fifteen seconds and said, "This code is horrible. This is not why Rich Hickey created this language. Anyway, back to your code, (let [_ (map zap-data! stuff)]...) is never going to run.


sure, laziness is also weird, but it's nearly impossible to do clojure without learning it for better or worse


is the goal here to convince the clojure community that we should be less cautious about dynamic vars?


@U11BV7MTK. "they can be changed anywhere in the call stack". You make dynamic rebinding sound like the GOTO of data. Sorry. They can be rebound anywhere in the call stack, to the data the developer wants operative for consumers of the given dynamic var. That sounds so much more controlled and semantically sane.


another issue here I think is that dynamic bindings are weirder in clojure than other lisps, trying to use them expose a lot of rough edges between the jvm machinery of call stacks / bindings / scopes and the abstractions we'd like in a lisp


the alternative would have been a massive loss of performance


"You make dynamic rebinding sound like the GOTO of data". I'm just pointing out why dynamic vars should give you pause and "to never assume the state of the var"


btw, I saw the re-frame discussing making it a library, with a "frame" being the context (app-db?) against which code would be run. They were not crazy about having to pass the "frame" down the call stack. Helloooooo! app-db ? Too easy?


OK, so in a callback is the app-db as visible to the caller, or the app-db visible to the creator of the callback used?


"is the goal here to convince the clojure community that we should be less cautious about dynamic vars?" When the child said, "The emperor has no clothes!", did they have a goal? My opening remark was that "This immutability thing may be out of control. "


The callback needs to be written to run against whatever happens to be bound at the time to frame . I mean, if I never hear the word "pure" again it will be too soon, but suddenly functions cannot be written against an abstract context? What happened to pure?


@U11BV7MTK, methinks the point remains that I absolutely know that the state of the bound var is the nearest dynamic binding. And as I said here ^^^, my code if it is any good is written against an abstraction such that it works regardless of the binding. Where the hell are the damn dragons?! 🐉🐉🐉


In the re-frame example I would kinda wonder what happens... You want to dispatch and subscribe given a certain frame - if the frame is stored in a dynamic variable and the dispatch happens in a DOM Event-Handler which doesn't have a stack on top of any binding... would there still be a frame? I would guess that on any event-loop iteration all bindings are gone as a new stack is established.


> The callback needs to be written to run against whatever happens to be bound at the time to frame . > but it's not a question of timing at all, it's a question of propagation, and I don't think this propagation scenario is as simple as you make it sound. it's admittedly simpler than it would be if you had threads, but it's still more complex than a value passed as an argument or a global you can look up on demand.


"Propagation"?! I am an expert on propagation, I wrote a glitch-free dataflow library, but what has this got to do with propagation? :) And do not be thrown by the word "time". The key is "the current binding" based on the dynamic call stack, as @U7ZL911B3 said ^^^^.


"'s still more complex than a value passed as an argument or a global you can look up on demand." You exalt global state over dynamic state? We may have to recall your "pure, functional merit badge". 🙂 I mean, what is not global about a dynamic var?! It is just more powerful, making functions more powerful because they are no longer written against a single global state, they are written against an abstract state that can be rebound by the caller to point a code base at different contexts. I cannot believe I have to argue this with a crowd that will not shut up about pure functions. 🙂


"if the frame is stored in a dynamic variable and the dispatch happens in a DOM Event-Handler " Lexical scope to the rescue, @U6JS7B99S. If we want to leverage first class functions ("We do! We do!") then we have to go all-in on the critters, and make sure they work against the data we intend them to. :on-click (let [lexi-var-1 (:var-1 frame )] (fn [event] (handle-it event lexi-var-1))) Old trick for the dynamic binding crowd.


Yes, but now you have to explicitely grab it and pass it on - another thing to think about. You also have to be aware of that this callback will somewhere need that binding and somehow pass it on / bind the callback.


yes, dynamic vars are more powerful than globals or immutable values, which is why I am cautious with them (note I've never claimed I don't use them). if my first concern is power I can use an assembler, in practice I find having less to keep track of helps me write simpler code and that means deliberately using less powerful tools in many cases.


"Yes, but now you have to explicitely grab it and pass it on - another thing to think about. " Hey, you set up the sick use case! Don't blame me. :) Don't forget, we are arguing about re-frame aspiring to library-hood and worrying about having different frames active at the same time and having it all work. I love pushing the limits, but I accept that I might have to think things through if I want to get that contorted. And sometimes I do. A case in point is my integration of CLJS Matrix and React Native, via the wonderful Helix. I totally have to deal with RN as a given, but I did this with Qooxdoo as well. It is a substantial but linear effort, and the problem is not dynamic vars, the problem is Impure Other Libraries we have to use for some some good reason.


One great example of "immutability out of control" is Stuart Sierra's apology on behalf of Component: "A component is similar in spirit to the definition of an object in Object-Oriented Programming. This does not alter the primacy of pure functions and immutable data structures in Clojure as a language. Most functions are just functions, and most data are just data. Components are intended to help manage stateful resources within a functional paradigm." The accurate sense that an apology was needed is just sad. We see it again in re-frame: "Now, to a functional programmer, effects are scary in a xenomorph kind of way. Nothing messes with functional purity quite like the need for side effects. On the other hand, effects are marvelous because they move the app forward. Without them, an app stays stuck in one state forever, never achieving anything. So re-frame embraces the protagonist nature of effects - the entire, unruly zoo of them - but it does so in a controlled and largely hidden way, and in a manner which is debuggable, auditable, mockable and pluggable." I mean, is Clojure pretty much 17th century Salem, NH? An "unruly zoo" mea culpa to fend off a stoning? This has consequences. One well-meaning observer blew off Matrix because "Clojure does not need to mutate state". I sent them the re-frame quote. Doubt it got through to them, because they already know re-frame is pure.


This thread got a bit heated. Discussions can and should be lively, but we should not target people. Let's keep this place nice for all

Joshua Suskalo17:08:00

> methinks the point remains that I absolutely know that the state of the bound var is the nearest dynamic binding. This is incorrect, as soon as there exists a thread-local binding, the vars are 100% mutable via usage of set!. For example:

(def ^:dynamic *some-var* 5)
(defn mutates!
  (set! *some-var* 10))
(binding [*some-var* 2]
  (println *some-var*))
;; 10

Joshua Suskalo17:08:38

I use this in my game engines for example to allow the construction of new entities in an otherwise pure function from old entity state to new entity state.

Joshua Suskalo17:08:28

And I get that your argument here is that purity of functions gets out of hand, and you can have an experience that says this is fine, but others are cautious about dynamic variables for good reason. Even if potentially that reason is that we don't have (and often don't desire to have) as much experience with them as we might if we used them everywhere.


Yes, @U5NCUG8NR, I never use the treacherous things myself except for their most magnificent use case, a library where (a) we need to work off some context but (b) have no interest in forever passing the context in as a parameter to every call. Which is very rarely! Useful, too, for tough debugging cases.

Joshua Suskalo17:08:10

I mean I'm far from bashing dynamic scope, and you need look no further than to see that. I'm just pointing out that there's perfectly valid reasons for people to be cautious with it, and that at least one of those reasons hadn't been mentioned yet.


(handler-bind ....)! Great project, @U5NCUG8NR. When do we start on AMOP? 🙂

Joshua Suskalo18:08:18

I think if you want to go that direction you might want to check out 😅

💯 3

I think CL atop Java is like the Yankees becoming a Red Sox farm team. 😞 Clojure is doing a fine job with that, we'll keep compiling to iron. My Matrix framework would gain some nice transparency with a modest bit of OO just to offer slot-value-using-class. Hopefully the Clojure "we don't need no stinkin' OO" crowd will not string me up too high. 🤞

Joshua Suskalo13:08:18

slot-value-using-class is literally just Clojure get though, even when you're using records to allow you to do type based dispatch. I'm confused.

Joshua Suskalo14:08:07

I guess the only usecase I can think of for slot-value-using-class that isn't directly covered by using get is in cases of multiple inheritance where multiple parent classes have the same slot. You can get more or less the same behavior (sans protocol implementations) by using namespaced keywords as your get targets though.


But you do not know what is in slot-value-using-class, @U5NCUG8NR! 🙂 exists precisely to allow get and put, if you will, to be customized. In one version of Matrix CL, the critical wiring needed to deliver transparent publish and subscribe was in SVUC and (setf SVUC). In the current CL version, we simply override the CLOS getters/setters with custom code that makes dataflow work like magic (no subscribe, no dispatch). In CLJ/S we lose some transparency by coding (mget <map> <property>). I think even that exposed wiring ruins the fun. In my TodoMVC I created little functions such as td-deleted? that did nothing other than an mget, and the code looked much nicer. JS has a win here over CLJS because it has this amazing define-property capability. This beats CL! Now I can create a JS object that corresponds to a DIV, give it all the input and derived properties it needs to do its job, and access those properties simply with mydiv.some_property, and that includes assignment! And with define_property I supply the necessary plumbing.

Joshua Suskalo14:08:52

So your intention here isn't to provide the behavior of slot-value-using-class, but to provide the behavior of setf macros and accessors? As you've noted, the whole immutability thing has gone "too far" and so while such a thing could be added I think without much issue, it wouldn't exactly feel very integrated into the language.

Joshua Suskalo14:08:40

I'll also argue personally that I think that such a feature is against the philosophy of Clojure because it ties two things together that should be separate: the data, and getting said data ready for use. It adds new points for arbitrary code and breaks the runtime characteristics parts of the contracts of the existing behavior of code if it were to be built in a way to integrate with existing facilities.

Joshua Suskalo14:08:47

Better in my opinion is simply writing accessors as separate functions, not hiding our data, and providing the behavior of said setf macros as additional functions that return transformed versions of the data. This is pretty much how the Clojure community already does things, and for good reason. You can perhaps dislike the culture and pervasiveness of the immutability, and distaste for encapsulation, but those things are pretty core to Clojure, which is why I suggested looking at ABCL.

Joshua Suskalo14:08:59

Which I'm not trying to deter you from the language, I just am looking at the desires you've expressed and it seemed like CL fit them better, but since you're using Clojure I'd assumed you had some desire to work with the JVM, hence my suggestion of using ABCL.


What Matrix does is what re-frame does. Is the Clojure community OK with re-frame?

Joshua Suskalo15:08:11

Sure, I've made no claims about Matrix though.


"such a feature is against the philosophy of Clojure because it ties two things together that should be separate: the data, and getting said data ready for use. It adds new points for arbitrary code and breaks the runtime characteristics parts of the contracts of the existing behavior of code if it were to be built in a way to integrate with existing facilities." Don't worry, you are going to love it. If React makes views a function of state, Matrix makes state a function of state, with views being perhaps the most value example of "state". (We dispute the model-view dichotomy--it is all model.)

Joshua Suskalo17:08:25

Well I guess that's something I didn't understand in your argument, is the discussion of use of this intended to be about state but not data? re-frame provides an abstraction over the state to allow access of pieces of the state (lenses if you will) as a separate component from the storage of that state. I had mistook your meaning to intend that this sort of behavior be extended to all data, but now I don't know.

Joshua Suskalo17:08:45

Or is the distinction between data and state a part of immutability having gone too far?


Matrix is not about all program data, just all interesting data manifest at the application semantic level, and even some mechanical stuff like XHR and persistence handling. Otherwise, yeah, it is all just Clojure as usual.


btw, @U5NCUG8NR, you are prolly aware that John McCarthy's Giant Leap was that code is data is code. I did not mention that because I do not actually see how the distinction applies to this discussion: Matrix pretty much just caches the functional model, with all the fancy internal wiring serving merely to keep the caches current and consistent as events alter app state. But any chance I get to cite McCarthy... 🙂

Andrew Berrien22:08:04

I am trying to run a simple one-time script written in Clojure, but I am getting (OutOfMemoryError) "Java heap space". When it happens, there is still unused RAM, so I think I should be able to increase the maximum heap size to complete the task. Any idea how I can do this? I don't have a whole project, just a script which I'm pasting into the REPL.


the heap space limit is set at startup of the jvm


if all you are doing is running a repl, you can skip lein entirely and just call java with the needed classpath and memory settings


@andrewpberrien an old trick to get a vanilla clojure given lein being available:

$ java -cp $(lein cp) clojure.main
Clojure 1.10.1


this uses lein to create a classpath string, and just runs clojure directly as the initial class for the jvm


you can add the -Xmx arg for heap size to that, and optionally replace that shell out for classpath with a hardcoded string

Andrew Berrien22:08:57

Thanks! I'm going to reboot the machine and try it with a bunch more memory. If this doesn't work then I guess I'll have to take a deeper look into my code. (I'm building and processing a sequence of 36M items)


@andrewpberrien also that hack above is exactly that, a hack, and clj gets you closer to configuring a jvm on startup as a normal thing, and babashka is designed for the kind of ad-hoc script running you are describing

Andrew Berrien23:08:29

It doesn't seem to work, giving me an error "Couldn't find project.clj, which is needed for classpath". I guess I will look into babashka...

Russell Mull23:08:31

@andrewpberrien Have you been running your repl with clj? If so, try out clj -J-Xmx512m


ah, sounds like you are running lain outside of a project, which is a whole other kettle of nonsense

Russell Mull23:08:44

(with a different limit to taste)


your best bet with be clojure -J-Xmx8GB your-file.clj if it needs no dependencies. I think @noisesmith was thinking you needed some dependencies and other namespaces from some directory. Seems to not be the case here


and he was showing you a helpful way to get rid of the weight of the most common build tool, lein, by just asking it to create a classpath and then just do your thing with bare java

Andrew Berrien23:08:50

I see... Thank you everyone for the help. It seems -J-Xmx works fine for my case. The script now runs perfectly!

Andrew Berrien23:08:54

I was only using Leiningen because it gives me a port to connect to the REPL from Vim and run stuff without switching windows