Fork me on GitHub
#off-topic
<
2017-11-12
>
souenzzo01:11:08

Real off: Julia language has some pretty cool introspects. With a simple macro, it returns you the "type coode", llvm code or native code that you run if you evaluate a block. http://blog.leahhanson.us/post/julia/julia-introspects.html

jcburley04:11:04

The Five Stages of Clojure: 1. I'm going to be so much more productive in Clojure! 2. It's so much fun learning Clojure! 3. It took me two weeks to set up my Clojure IDE.... 4. How the heck do I do XYZ in Clojure?? 5. I suck at Clojure.

val_waeselynck08:11:19

6. The other languages suck at me.

seancorfield04:11:58

Having set up and torn down three completely different Emacs configurations and then switching to Atom/ProtoREPL, I totally agree with 3!

lovuikeng05:11:58

been following your work since the day of CFML, to CF components, until I switched to Spring/Java. Got interest into clojure a couple of years ago, talks of RH, and the interest got stronger ever since. A few months back, out of curiosity to check on An Architect's View, found that our mentor already contributing to clojure community for more than a few years! Now, it's more than comforting to hear comments like these again from you, thank you @seancorfield

seancorfield06:11:53

I'll never escape my past, it seems! šŸ˜† Good to hear another former CFer finding their way to Clojure!

lovuikeng06:11:20

yes, feeling like reborn... in a much better way šŸ™‚

seancorfield04:11:46

I definitely have moments of 5 but now that I've been doing Clojure in production for 6+ years, I'm back to 1 & 2 all the time now!

qqq06:11:00

"3" in my case meant: * switching from vim to emacs * buying https://www.kinesis-ergo.com/ this took slightly more than two weeks

qqq06:11:24

I'm still hoping someone will rewrite emacs in clojure, so I can do scripting in clojure instead of elisp

mpenet07:11:34

There was an attempt, deuce. Seems abandoned now

vemv12:11:01

extending Atom in clojurescript would have lots of potential. someone has to do the hard work though... and keep up with a fast-moving target as Atom is

dominicm12:11:00

That's already been done afaik

vemv12:11:13

nice one, I like how simple the development process is (as per readme) but seems quite evident that Atom is not ready for primetime for serious Clojure work (if you know emacs already) when Atom is a more viable approach it'll have https://github.com/clojure-emacs/refactor-nrepl integration and such?

dominicm13:11:04

Atom with proto-repl would be considered a first class editor for clojure imo.

seancorfield16:11:34

@vemv ProtoREPL provides a pretty solid base. I used Emacs/CIDER prior to switching to Atom/ProtoREPL and have zero regrets. I don't miss Emacs at all šŸ™‚

seancorfield16:11:24

I used Emacs back in the version 17, 18 days, switched to other editors just after 19 came out, as I recall. Went back to it just as 24 was in prerelease because I was using Clojure. Went through three complete rebuilds of my Emacs setup. Switched to ProtoREPL after seeing Jason's talk at Conj 2016. Never been happier!

qqq16:11:58

@seancorfield: that is a strong recommendation; do you have a screencast of yourself workingin atom/proto-repl ?

seancorfield16:11:54

I do not. Mostly because I spend so much of my time working on a proprietary code base.

seancorfield16:11:04

Looking at Emacs release dates, that represents about a decade of usage '85-'95, and then about four years '12-'16. I tried a bunch of other Clojure solutions too during that time (even TextMate with a plugin!). I liked LightTable when it came out, but incompatibilities with OS X releases drove me away. I tried Sublime Text as well, but for various reasons it just annoyed me when working cross-platform.

seancorfield16:11:37

@qqq What I can tell you about my workflow is that I generally have a REPL running, minimized to about three lines at the bottom of the screen and I almost never type into it. I write code in a source/test file, evaluate it with a hot key, look at the inline results (one of the things I loved about LightTable and also love about ProtoREPL with Ink), rinse and repeat. If I want to try "REPL stuff", I add a (comment ...) to my source file and write my experiments inline in that, eval'ing into the REPL as I go.

seancorfield17:11:11

For files with -main functions, I generally have a (comment ...) below the -main function that has the steps needed to build my system Component, and start and stop it, along with any convenient expressions for modifying logging levels etc (we use timbre).

vemv17:11:44

Personally I use Atom a lot but not for Clojure at the moment. The day I can easily compose my own commands, modify just about anything at runtime, and be backed by an active community I'll be there for sure. It's unfortunate that protorepl stalled last June - let's hope activity recovers

seancorfield17:11:31

Aye, I talked to Jason about that. He hopes to get back on it, but I think he would also welcome contributors.

hmaurer22:11:59

To be honest, I have almost never used Emacs before and use Atom for most of my day-to-day development, so it was natural for me to try protorepl when getting started with Clojure. I nonetheless gave CIDER a try, and I find it miles and miles ahead in terms of UX compared to protorepl.

Lucas Barbosa22:11:08

@hmaurer thatā€™s exactly what happened to me šŸ™‚ Started with Atom (since it was my standard tool) and switched to Emacs with CIDER. I regret not switching before.

Lucas Barbosa22:11:41

Guys, is anybody familiar with any resource regarding ā€œincremental I/Oā€? I donā€™t know the exact term for this, but the idea is that I donā€™t have access to the whole InputStream, but rather parts of it. Specifically, I am trying to build a non-blocking chat server using Java NIO. I want to get more insight about how to accumulate clientā€™s message parts and eventually combine parts into full messages

Lucas Barbosa22:11:24

When I say ā€œparts of itā€, I mean arbitrary chunks of data at each read time

Lucas Barbosa22:11:09

Some friends at #beginners mentioned modeling this as a state machine

hmaurer22:11:22

@lvbarbosaI am not quite sure wha tyou mean; you could just buffer incoming message chunks until you get a full one?

viniciushana22:11:36

You guys motivated me to take a look at ProtoREPL and it indeed seems interesting! I'm finding it to be very easy to use. OTOH, I'm used to Cursive, which I find to be excellent to my needs - the fact it indexes the source without an active REPL makes things much quicker to me.

viniciushana22:11:31

As for my CIDER experiences, I got frustrated over how easy it was to break my setup. Gave up after a week or so, with a few attempts to try it again which ended the same way.

viniciushana22:11:49

Pretty sure it got better over time, my figures are 2015-ish

Lucas Barbosa22:11:29

@hmaurer Yes, thatā€™s the thing I have in my mind. However, I am particularly having some troubles with how to decide whether a bunch of ByteBuffers contains full messages or not. I tried parsing them to Strings, but this breaks the system when the last byte read was just a piece of a unicode code point. My language (portuguese) has a lot of those (Ć© Ƨ Ć£ etc)

hmaurer22:11:09

Do you have control over the protocol? Is it a binary protocol?

Lucas Barbosa22:11:12

Indeed this doesnā€™t really seem to have anything to do with streamsā€¦

Lucas Barbosa22:11:39

Itā€™s just a toy project, I can do whatever I want, just learning here šŸ™‚

hmaurer22:11:51

What about including the length of the message in the messageā€™s header?

hmaurer22:11:19

e.g. each message would have this format: ā€œ[ID : SHORT] [LENGTH : SHORT] [CONTENT : BYTES]ā€

viniciushana22:11:19

I can recall that .NET had a memory mapped stream. Maybe there is something similar in Java?

hmaurer23:11:08

(thatā€™s what a videogame I worked on did)

Lucas Barbosa23:11:26

@viniciushana I remember seeing that for Files in the NIO package

Lucas Barbosa23:11:09

@hmaurer Hmm.. Thatā€™s clever. I was using a very simple ā€œline-break orientedā€ approach

val_waeselynck23:11:48

@lvbarbosa I don't know if this helps, but EDN, transit and fressian have an API for reading the next input from an input stream

hmaurer23:11:54

I mean, thatā€™s if you are using a binary protocol. I am sure you could get away with a text-based protocol or something

hmaurer23:11:06

IRCā€™s protocol is text-based afaik

hmaurer23:11:09

maybe take a look at it?

hmaurer23:11:12

see how they do things

hmaurer23:11:06

if I was you I would try to implement a binary protocol on your toy project though

hmaurer23:11:08

more fun šŸ˜„

hmaurer23:11:25

But basically, it could work like this: receive some bytes and add them to buffer. Do you have enough bytes in buffer to read a message header? ok, read it. Do you have enough bytes to read the message content? Yes? Read it. No? Wait for more bytes

hmaurer23:11:39

Do this in a loop in case multiple messages arrived in the buffer in one chunk

hmaurer23:11:11

Donā€™t quote me on this though, I am by no mean an expert on networking stuff šŸ˜„

Lucas Barbosa23:11:23

@val_waeselynck thatā€™s cheating! šŸ˜„ I want to write the whole solution to gain more experience

Lucas Barbosa23:11:39

@hmaurer thatā€™s ok, I now have some keywords to help me on the research šŸ™‚ Thanks a lot!

Lucas Barbosa23:11:47

and it makes a lot of sense

hmaurer23:11:25

I saw this by reverse-engineering a videogame

hmaurer23:11:32

so hopefully itā€™s not completely stupid

Lucas Barbosa23:11:29

Thatā€™s impressing

Lucas Barbosa23:11:30

Just a last thought: is it normal to feel bad when using Java objects in Clojure? šŸ˜„ I look at my code and it looks awful when doing interop. Let me try to find an example that I pasted in the #beginners channel asking for help