Re: [BLOG] Once Upon A Class

2021-05-24 Thread Sean Corfield
Much clearer now! Thank you!

On Mon, May 24, 2021 at 4:22 PM daniel szmulewicz <
daniel.szmulew...@gmail.com> wrote:

> Hi Sean,
>
> Thank you for explaining what was confusing. With that input, I've edited
> my blog post, separating the parts that apply to both REPL and nREPL and
> those that apply to nREPL only.
> I hope this avoids the pitfall you've described, and that the general
> discussion on Clojure's on-the-fly code generation and class loading
> mechanism will be of benefit to all Clojurians.
>
> Daniel
>
> On Tue, May 25, 2021 at 1:30 AM Sean Corfield  wrote:
>
>> It wasn't clear to me that the entire article only applies to nREPL.
>> Especially since most of the article just uses "REPL" and most of the code
>> does work in a normal REPL -- and you start with:
>>
>> Our exploration of the topic makes heavy use of a REPL, I invite you to
>> fire one up and play along.
>>
>> and then later say:
>>
>> It is worth reproducing the experiment in a plain Clojure REPL and a
>> nREPL client side by side.
>>
>> which makes it seem like everything up to that point applies to both and
>> this part is a specific difference.
>>
>> (the article may be particularly confusing for me since I never use nREPL
>> at all so "REPL" = "Clojure REPL" as far as I'm concerned)
>>
>> On Mon, May 24, 2021 at 1:21 PM daniel szmulewicz <
>> daniel.szmulew...@gmail.com> wrote:
>>
>>>
>>> Hi Sean,
>>>
>>> Absolutely, the growing stack of context class loaders is a quirk of the
>>> nREPL client.
>>>
>>> * something fairly unexpected is that with a CIDER/nREPL setup, each
>>> evaluation adds an extra classloader*
>>>
>>> And later I write:
>>>
>>> In the default REPL, one instance of DynamicClassLoader stays associated
>>> with the REPL throughout the session. In a nREPL client, instances of
>>> DynamicClassLoader keep piling up.
>>>
>>> If you think there is a lack of clarity, I'll be happy to amend the text
>>> to make it less likely for the reader to miss that. Thank you very much for
>>> your input.
>>>
>>> Daniel
>>>
>>> On Mon, May 24, 2021 at 10:58 PM Sean Corfield 
>>> wrote:
>>>
 When I tried some of your code in a default REPL (via the Clojure CLI),
 I don't see the same results. In particular:

 user=> (hash (.getContextClassLoader (Thread/currentThread)))

 1865201235

 user=> (hash (.getContextClassLoader (Thread/currentThread)))

 1865201235

 user=> (hash (.getContextClassLoader (Thread/currentThread)))

 1865201235

 user=> (hash (.getContextClassLoader (Thread/currentThread)))

 1865201235

 (although all the rest of it seems to apply)

 On Mon, May 24, 2021 at 2:10 AM Daniel Szmulewicz <
 daniel.szmulew...@gmail.com> wrote:

> Every time you press ENTER at the REPL, a new class is created. In
> addition, it comes with a new class loader instance exclusively dedicated
> to loading it. That's Clojure behind the scenes doing its runtime magic. 
> On
> the other hand, in a nREPL client like Cider, not one but two class loader
> instances are produced, and that is a quirk that carries over since its
> earliest days. I bring you that story as an excuse for dwelling on the
> subject of class loading. Arcane, maybe, but essential.
>
> Read on .
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com
> 
> .
>


 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- https://corfield.org/
 World Singles Networks, LLC. -- https://worldsinglesnetworks.com/

 "Perfection is the enemy of the good."
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe 

Re: [BLOG] Once Upon A Class

2021-05-24 Thread daniel szmulewicz
Hi Sean,

Thank you for explaining what was confusing. With that input, I've edited
my blog post, separating the parts that apply to both REPL and nREPL and
those that apply to nREPL only.
I hope this avoids the pitfall you've described, and that the general
discussion on Clojure's on-the-fly code generation and class loading
mechanism will be of benefit to all Clojurians.

Daniel

On Tue, May 25, 2021 at 1:30 AM Sean Corfield  wrote:

> It wasn't clear to me that the entire article only applies to nREPL.
> Especially since most of the article just uses "REPL" and most of the code
> does work in a normal REPL -- and you start with:
>
> Our exploration of the topic makes heavy use of a REPL, I invite you to
> fire one up and play along.
>
> and then later say:
>
> It is worth reproducing the experiment in a plain Clojure REPL and a nREPL
> client side by side.
>
> which makes it seem like everything up to that point applies to both and
> this part is a specific difference.
>
> (the article may be particularly confusing for me since I never use nREPL
> at all so "REPL" = "Clojure REPL" as far as I'm concerned)
>
> On Mon, May 24, 2021 at 1:21 PM daniel szmulewicz <
> daniel.szmulew...@gmail.com> wrote:
>
>>
>> Hi Sean,
>>
>> Absolutely, the growing stack of context class loaders is a quirk of the
>> nREPL client.
>>
>> * something fairly unexpected is that with a CIDER/nREPL setup, each
>> evaluation adds an extra classloader*
>>
>> And later I write:
>>
>> In the default REPL, one instance of DynamicClassLoader stays associated
>> with the REPL throughout the session. In a nREPL client, instances of
>> DynamicClassLoader keep piling up.
>>
>> If you think there is a lack of clarity, I'll be happy to amend the text
>> to make it less likely for the reader to miss that. Thank you very much for
>> your input.
>>
>> Daniel
>>
>> On Mon, May 24, 2021 at 10:58 PM Sean Corfield  wrote:
>>
>>> When I tried some of your code in a default REPL (via the Clojure CLI),
>>> I don't see the same results. In particular:
>>>
>>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>>
>>> 1865201235
>>>
>>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>>
>>> 1865201235
>>>
>>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>>
>>> 1865201235
>>>
>>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>>
>>> 1865201235
>>>
>>> (although all the rest of it seems to apply)
>>>
>>> On Mon, May 24, 2021 at 2:10 AM Daniel Szmulewicz <
>>> daniel.szmulew...@gmail.com> wrote:
>>>
 Every time you press ENTER at the REPL, a new class is created. In
 addition, it comes with a new class loader instance exclusively dedicated
 to loading it. That's Clojure behind the scenes doing its runtime magic. On
 the other hand, in a nREPL client like Cider, not one but two class loader
 instances are produced, and that is a quirk that carries over since its
 earliest days. I bring you that story as an excuse for dwelling on the
 subject of class loading. Arcane, maybe, but essential.

 Read on .

 --
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>> Sean A Corfield -- (904) 302-SEAN
>>> An Architect's View -- https://corfield.org/
>>> World Singles Networks, LLC. -- https://worldsinglesnetworks.com/
>>>
>>> "Perfection is the enemy of the good."
>>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups 

Re: [BLOG] Once Upon A Class

2021-05-24 Thread Sean Corfield
It wasn't clear to me that the entire article only applies to nREPL.
Especially since most of the article just uses "REPL" and most of the code
does work in a normal REPL -- and you start with:

Our exploration of the topic makes heavy use of a REPL, I invite you to
fire one up and play along.

and then later say:

It is worth reproducing the experiment in a plain Clojure REPL and a nREPL
client side by side.

which makes it seem like everything up to that point applies to both and
this part is a specific difference.

(the article may be particularly confusing for me since I never use nREPL
at all so "REPL" = "Clojure REPL" as far as I'm concerned)

On Mon, May 24, 2021 at 1:21 PM daniel szmulewicz <
daniel.szmulew...@gmail.com> wrote:

>
> Hi Sean,
>
> Absolutely, the growing stack of context class loaders is a quirk of the
> nREPL client.
>
> * something fairly unexpected is that with a CIDER/nREPL setup, each
> evaluation adds an extra classloader*
>
> And later I write:
>
> In the default REPL, one instance of DynamicClassLoader stays associated
> with the REPL throughout the session. In a nREPL client, instances of
> DynamicClassLoader keep piling up.
>
> If you think there is a lack of clarity, I'll be happy to amend the text
> to make it less likely for the reader to miss that. Thank you very much for
> your input.
>
> Daniel
>
> On Mon, May 24, 2021 at 10:58 PM Sean Corfield  wrote:
>
>> When I tried some of your code in a default REPL (via the Clojure CLI), I
>> don't see the same results. In particular:
>>
>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>
>> 1865201235
>>
>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>
>> 1865201235
>>
>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>
>> 1865201235
>>
>> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>>
>> 1865201235
>>
>> (although all the rest of it seems to apply)
>>
>> On Mon, May 24, 2021 at 2:10 AM Daniel Szmulewicz <
>> daniel.szmulew...@gmail.com> wrote:
>>
>>> Every time you press ENTER at the REPL, a new class is created. In
>>> addition, it comes with a new class loader instance exclusively dedicated
>>> to loading it. That's Clojure behind the scenes doing its runtime magic. On
>>> the other hand, in a nREPL client like Cider, not one but two class loader
>>> instances are produced, and that is a quirk that carries over since its
>>> earliest days. I bring you that story as an excuse for dwelling on the
>>> subject of class loading. Arcane, maybe, but essential.
>>>
>>> Read on .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- https://corfield.org/
>> World Singles Networks, LLC. -- https://worldsinglesnetworks.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/uypJ_9opzN0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/clojure/CAD4thx_ENAaAV2Oa5dLNQW51sg7W4VU6nWfM3r0Qgx9HYsqd-g%40mail.gmail.com
>> 
>> .
>>
> --
> You received this 

Re: [BLOG] Once Upon A Class

2021-05-24 Thread daniel szmulewicz
Hi Sean,

Absolutely, the growing stack of context class loaders is a quirk of the
nREPL client.

* something fairly unexpected is that with a CIDER/nREPL setup, each
evaluation adds an extra classloader*

And later I write:

In the default REPL, one instance of DynamicClassLoader stays associated
with the REPL throughout the session. In a nREPL client, instances of
DynamicClassLoader keep piling up.

If you think there is a lack of clarity, I'll be happy to amend the text to
make it less likely for the reader to miss that. Thank you very much for
your input.

Daniel

On Mon, May 24, 2021 at 10:58 PM Sean Corfield  wrote:

> When I tried some of your code in a default REPL (via the Clojure CLI), I
> don't see the same results. In particular:
>
> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>
> 1865201235
>
> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>
> 1865201235
>
> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>
> 1865201235
>
> user=> (hash (.getContextClassLoader (Thread/currentThread)))
>
> 1865201235
>
> (although all the rest of it seems to apply)
>
> On Mon, May 24, 2021 at 2:10 AM Daniel Szmulewicz <
> daniel.szmulew...@gmail.com> wrote:
>
>> Every time you press ENTER at the REPL, a new class is created. In
>> addition, it comes with a new class loader instance exclusively dedicated
>> to loading it. That's Clojure behind the scenes doing its runtime magic. On
>> the other hand, in a nREPL client like Cider, not one but two class loader
>> instances are produced, and that is a quirk that carries over since its
>> earliest days. I bring you that story as an excuse for dwelling on the
>> subject of class loading. Arcane, maybe, but essential.
>>
>> Read on .
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- https://corfield.org/
> World Singles Networks, LLC. -- https://worldsinglesnetworks.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/uypJ_9opzN0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/CAD4thx_ENAaAV2Oa5dLNQW51sg7W4VU6nWfM3r0Qgx9HYsqd-g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAABPU68OsZ8XdejzTzz%2BZ%3DvyP4P-ECPm3j1sbqZyMMkN5Giicw%40mail.gmail.com.


Re: [BLOG] Once Upon A Class

2021-05-24 Thread Sean Corfield
When I tried some of your code in a default REPL (via the Clojure CLI), I
don't see the same results. In particular:

user=> (hash (.getContextClassLoader (Thread/currentThread)))

1865201235

user=> (hash (.getContextClassLoader (Thread/currentThread)))

1865201235

user=> (hash (.getContextClassLoader (Thread/currentThread)))

1865201235

user=> (hash (.getContextClassLoader (Thread/currentThread)))

1865201235

(although all the rest of it seems to apply)

On Mon, May 24, 2021 at 2:10 AM Daniel Szmulewicz <
daniel.szmulew...@gmail.com> wrote:

> Every time you press ENTER at the REPL, a new class is created. In
> addition, it comes with a new class loader instance exclusively dedicated
> to loading it. That's Clojure behind the scenes doing its runtime magic. On
> the other hand, in a nREPL client like Cider, not one but two class loader
> instances are produced, and that is a quirk that carries over since its
> earliest days. I bring you that story as an excuse for dwelling on the
> subject of class loading. Arcane, maybe, but essential.
>
> Read on .
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com
> 
> .
>


-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- https://corfield.org/
World Singles Networks, LLC. -- https://worldsinglesnetworks.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAD4thx_ENAaAV2Oa5dLNQW51sg7W4VU6nWfM3r0Qgx9HYsqd-g%40mail.gmail.com.


[BLOG] Once Upon A Class

2021-05-24 Thread Daniel Szmulewicz
Every time you press ENTER at the REPL, a new class is created. In 
addition, it comes with a new class loader instance exclusively dedicated 
to loading it. That's Clojure behind the scenes doing its runtime magic. On 
the other hand, in a nREPL client like Cider, not one but two class loader 
instances are produced, and that is a quirk that carries over since its 
earliest days. I bring you that story as an excuse for dwelling on the 
subject of class loading. Arcane, maybe, but essential.

Read on .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d7c270ef-d8e0-4935-ac2f-6fd56c9d4c3en%40googlegroups.com.