clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
jimmy 2019-12-23T15:45:50.010700Z

Other than looking at the compiler source, does any documentation for case* exist? I thought I’d find it here, but I don’t see any mention of it. https://clojure.org/reference/special_forms

alexmiller 2019-12-23T15:49:12.011100Z

it's an implementation detail of case

alexmiller 2019-12-23T15:49:30.011300Z

you shouldn't use it directly

alexmiller 2019-12-23T15:49:59.011800Z

like other foo* things in core, it's a hook into the Compiler

alexmiller 2019-12-23T15:53:03.012Z

fn*, let*, etc

jimmy 2019-12-23T16:21:30.014300Z

Yes I know that I shouldn't use it directly. I am doing some analysis on fully macroexpanded code and trying to understand what to means. So I was curious if there is documentation on it. If not that is fine.

alexmiller 2019-12-23T16:28:42.014500Z

nope

alexmiller 2019-12-23T16:29:37.015500Z

case is surprisingly complicated as there is a lot of work to try to set up a tableswitch byte code - that code is kind of half split between code in core and code in the Compiler

👍 1
alexmiller 2019-12-23T16:29:55.015800Z

case* is the transition point between those

2019-12-23T16:45:57.017700Z

to have implementation-detail special forms means the result of a macroexpansion is implementation-detail as well

2019-12-23T16:47:02.017900Z

that's not very helpful

alexmiller 2019-12-23T17:02:49.018900Z

it's not really helpful or harmful, it's a detail that few people ever see or are affected by

2019-12-23T19:08:31.020400Z

so how to deal with this detail when you happen to be affected by it ?

2019-12-23T19:13:22.021Z

learn more about it, and figure out what you need to do for your use case? It is kind of a wide-open question, without a particular situation in hand that requires dealing with it.

2019-12-23T19:15:19.021600Z

it's not wide-open, it's about what can we rely on vs what is implementation detail

2019-12-23T19:18:00.024100Z

It seems unlikely that anyone has the time to answer all such questions about every aspect of Clojure in advance -- that would take years.

2019-12-23T19:19:37.025300Z

I mean, if you are hitting an issue involving case* and you want to ask about that, go for it. But if you just want someone to go off and write down every aspect of case and case* that is detail vs. promised-for-N-future-versions, it is hard to see anyone motivated to do so.

alexmiller 2019-12-23T19:20:54.026100Z

In what way are you affected?

2019-12-23T19:22:55.027900Z

I was affected in the writing of cloroutine, and I'm pretty sure core.async faced similar issues

2019-12-23T19:23:33.029100Z

basically every non-trivial macro needing to deep walk the ast needs a way to do proper macroexpansion

2019-12-23T19:23:52.029700Z

today the only robust way to do that is to rely on the official analyzer

2019-12-23T19:24:08.030200Z

There are only about 3 non-trivial macros, by that definition 🙂

alexmiller 2019-12-23T19:24:21.030600Z

so, this only affects people doing deep transformations on Clojure ASTs and there is an official lib that helps you do so

alexmiller 2019-12-23T19:25:05.031100Z

seems unimportant relative to many other things to me

2019-12-23T19:25:30.031600Z

I don't deny that

2019-12-23T19:25:35.031700Z

In part, because such macros are painstaking to write and test, I know.

2019-12-23T19:26:28.032600Z

what I mean is, in general, it's hard to figure out where the implementation-detail frontier starts

2019-12-23T19:28:36.034900Z

No argument there. For particular questions, we have a liaison to an oracle 🙂 For some fraction of such questions in general, it has become semi-common knowledge among the kind of people that frequent this channel. For all such questions in general, there are too many to imagine and write answers for.

2019-12-23T19:29:27.035800Z

having an official tooling mitigates the problem, but we're still stuck with weird special forms like cljs's js* which are totally opaque

2019-12-23T19:29:41.036200Z

@leonoel Do you actually have a question, or are you wanting to complain about a previous experience?

2019-12-23T19:30:11.036800Z

It seems the latter. Especially given you didn’t even originate the discussion.

2019-12-23T19:34:03.038100Z

I don't have a specific question, but I'm interested in the big picture

2019-12-23T19:35:01.039300Z

Others can correct me if I veer from the truth here, but I think part of the big picture is that there is not, and likely never will be, a "formal specification" document for Clojure, the way there is for Common Lisp or Scheme.

2019-12-23T19:35:34.040100Z

This seems the type of thing that you could contribute to.

2019-12-23T19:36:15.041600Z

If you have had conversations or insights that might be generally useful, you could write them up.

2019-12-23T19:36:32.042500Z

If there are specific questions that you feel need answering, you could ask them.

2019-12-23T19:36:33.042600Z

And that irks some people, but Clojure is far from the only language in that situation. Such documents can be useful, but can be monumentally time consuming to write, maintain, and argue over.

2019-12-23T19:37:04.043300Z

I've thought about it but so far I've seen zero clue that this work would even be considerated

2019-12-23T19:37:41.043800Z

Alex is generally very helpful when you have a specific question.

2019-12-23T19:37:51.044100Z

I know that

2019-12-23T19:38:17.044300Z

So what’s stopping you?

2019-12-23T19:40:42.045200Z

is there interest in clojure team to have a specification for clojure ?

2019-12-23T19:41:30.045900Z

I mean, there’s a difference between an Official Spec™ and, “Here’s the available information.”

2019-12-23T19:41:45.046200Z

It’s easy to provide the latter.

➕ 1
2019-12-23T19:44:43.047500Z

“easy” — I mean “easier than convincing a bunch of people that something they don’t seem to want to do is worth their time”

2019-12-23T19:45:05.047900Z

of course, it’s not Just Easy

2019-12-23T19:45:19.048100Z

I get your point

alexmiller 2019-12-23T19:53:50.048400Z

there is disinterest in having a specification

2019-12-23T19:55:24.050300Z

I do not know others thinking on this, but one expectation that might be in some people's minds is that a specification is an invitation to get beat over the head with it in bug reports, after spending the enormous time required to write it.

alexmiller 2019-12-23T19:56:49.051300Z

it's not that (although, yes it would take a lot of time and effort to both write and vet)

alexmiller 2019-12-23T19:59:24.053900Z

it's that specifications constrain you. Rich believes there is more utility in being able to extend the language in useful ways over time than spending a lot of time creating boundaries. There are many places in Clojure where there is ambiguity. One type of person sees those as liabilities, another perceives them as opportunities. Rich is firmly in the latter camp.

alexmiller 2019-12-23T20:10:46.060100Z

Rich places a lot of value on being able to create sustainable software that can be updated over time as requirements change. You see that ideal in many aspects of Clojure's design, and you see it in the implementation itself. Creating a specification both takes time away from making Clojure better, while simultaneously erecting more barriers to extension in the future.

alexmiller 2019-12-23T20:11:49.061200Z

These are my own perceptions of Rich's beliefs, so I am not transmitting them as well as he would. Those errors are mine.

2019-12-23T20:13:56.061800Z

Why pour concrete when it is expensive, and more importantly, you did not want concrete there?

alexmiller 2019-12-23T20:20:10.062700Z

The reason I originally grabbed http://insideclojure.org was the thought that some day, maybe, I would write a book about the implementation of Clojure with that name.

👍 2
➕ 1
jumar 2019-12-25T11:59:40.077500Z

That would be awesome. I found Clojure in Small Pieces a long time ago but lot of it is just copy pasted code without real explanations.

alexmiller 2019-12-23T20:21:06.063200Z

doing so would be a multi year effort and I haven't started yet, so it may be a while :)

seancorfield 2019-12-23T20:42:10.065600Z

As someone who was a (paying) member of J16 for eight years, working on the ANSI C++ Standard, and peripherally involved with both the ISO C standardization process and early discussions about whether Java should have an ANSI or ISO standard or go through the ECMA process, I can say with my hand on my heart that I'm rather glad Clojure isn't going through that process.

seancorfield 2019-12-23T20:46:14.068500Z

Standards (and "Specifications") can and do change over time but it's a Big Deal(™) and it's nearly always a very slow and laborious process. And the reality is that most compilers for languages that have a standard are still incompatible in certain ways and nearly all have non-standard extensions requested by users -- that often end up being incompatible with whatever version of those features get standardized at some future date.

seancorfield 2019-12-23T20:46:46.069Z

(so, yeah, I'm firmly in the Rich camp on this one)

bronsa 2019-12-23T23:51:19.069500Z

I can expand a bit the docs there if needed

2019-12-23T23:56:09.070800Z

tools.analyzer* are such awesome libs.