📜 ⬆️ ⬇️

How I found the best programming language in the world. Part 2

The first part is here . Continued:

Seven fucking years, I was waiting for a language that at least somehow responds to parts of my desires. During this time, and in the background, I pre-everything. Everything - means all the garbage of general purpose, and all the garbage is not quite general purpose. You can not feel the language just by reading something about it and writing Hello World. To understand - it is necessary at least a little to program - to write a thread thing. And all this time, in the moments of despair, I shook a thread “wonderful language” and tried to write something. Some things even still spinning in the office (or spinning).

Clojure



Did any small things, such as REST-server of licenses for Clojure, which he postponed after. Verdict: Clojure - functional PHP. The feelings (emotions) of programming are the same as when programming in PHP. Sometimes positive (especially at the beginning), exactly like from many languages ​​with dynamic typing: hop-hop and production, everything is beautiful and works, the code is rather elegant if you train your eyes to recognize brackets. In general, my attitude was the same as for PHP, if I need to fuck what thread a page on the server showing something to my colleagues from the database - I will take PHP, there is nothing better to solve this problem quickly and reliably. Something more complicated - cranes. Requires a big head, some kind of production culture, tools / processes and so on. And then worse and worse.
')
In no case will I say that Clojure is bad. Rich Hickey (creator of Clojure) - the head, concepts in Clojure (PDS, STM) are just fine, but they have little to do with the language and can be implemented everywhere. Well, discarding the concept is Lisp, and fortunately I don’t have a beard to write Lisp in 2015. Some of Clojure, like PHP, write really big, complex, and Clojure does amazing things ( Datomic alone is worth something), but again, dynamic typing is not interesting for me. This is all for people with a large memory module in the head. In short, the new model of Volkswagen Beetle - you can go to the club, but for Camel Trophy is useless.

Scala



Scala - I came back to it several times and threw it several times. I understand perfectly what Scala attracts inexperienced youth (and she basically wants Scala). Attracts several things:


To go far, the last time I returned to Scala was a week ago. I had to choose the language “yesterday”, and, I repent, I decided that Scala would be the minimum evil. The presence of ScalaJS and the relatively rich possibility of metaprogramming (read the macros) gave me hope that you can steer. In addition, some hipster from EPFL began to solve for me some problems with off-heap data structures , voiced in the first part of the article.

In general, I took a deep breath and told a colleague: “In short, we will be going to write Next Big Thing on Scala. So the guys are fucking crazy - I've been driving Scala for years and now this kind of opanka: the concept has changed ... ” . Having tuned in to the positive, I began to try to program something. Immediately I will say the knowledge of Scala and my experience is close to zero, which I compensate for with knowledge and experience in life. It was immediately clear that I needed Type Classes, well, and let's look at the Internet. Immediately stumble on some, forgive me Scala fans, shapey libby , from Miles Sabin.

Retreating briefly, I don’t like this type of Miles since our first and last meeting. It was at EclipseCon 2009 (or so). I stand a beer on the stand, this pepper fits here, I'm like Miles Sabin, I write Eclipse-based IDE for Scala, I want to rub it with DLTK programmers for kid things (and in his Scala IDE JDT he bent, in general, some strange garbage toiled, and he had an IDE - shit. As I understand it, I wrote my TypeSafe later - but I did not look at it). Well, this type of Miles tells me where are the programmers here? I him well, I am a programmer, you can talk to me. And I, as it were, in those times looked so much that he didn’t look like a programmer at all, rather like a utility worker. Well, here Miles says, like you do not need me, let's programmers. Bitch :) But I didn’t explain to him that I’m the type of DLTK Project Lead, and moreover I’m aware of the fact that he would never do his IDE normally because he didn’t go there, but he didn’t. He sent it to Lech Panchenko, and went on to plump with the boys ... In general, the world is cramped.


Well, I google, which means this shapeless (and I need type classes). They do not have documentation, as it is supposed to by the elite, and in the first paragraph they immediately refer to four scientific articles. Further it is written how to help them, where to and how to compile. And pipets. Well, let me google further - there are vidos from this Miles where he talks about his miracle. For 40-45 minutes, about the fact that the basis of shapeless is his magic invention called HList. And this is the type of main feature that he has been tormenting for the last few years, and it almost earned, and then macros were added to Scala and he redid his chip (HList) and now this HList is more awesome than the old HList. He muted it for a really long time, with a HER code cloud, which basically looks like this:

 object IsHCons1 {

   type Aux [L [_], FH [_ [_]], FT [_ [_]], H0 [_], T0 [_] <: HList] = IsHCons1 [L, FH, FT] {type H [ t] = H0 [t];  type T [t] = T0 [t]}

   def apply [L [_], FH [_ [_]], FT [_ [_]]] (implicit tc: IsHCons1 [L, FH, FT]): Aux [L, FH, FT, tc.H, tc.T] = tc

   implicit def mkIsHCons1 [L [_], FH [_ [_]], FT [_ [_]]]: IsHCons1 [L, FH, FT] = macro IsHCons1Macros.mkIsHCons1Impl [L, FH, FT]

 }


Is that even what? This is for whom? Is it for people or not? Are you suggesting that I write this every day, and hundreds of lines and stay in my right mind, or is it for Imita, and we, the earthly practitioners, will use this yours?


What to do next, after the listener has learned the HList, he does not have time to tell all three times, referring to his workshops, vidos and courses that we can all acquire for money. I don’t mind acquiring knowledge for money, but:

The dude killed years for people to kill weeks and months for the bitch to refer to the type , and to understand the type of value in runtime, well, if you want to mix something there at the compilation stage (like know the size of the collection), and to do it , it is necessary to carry out the brain so well, and to cheat a code like the one I mentioned above. Of course, I didn’t penetrate deeply, maybe this shapeless which needs to kill a cloud of time (and which is probably not the world's most sophisticated Scala library) does something else useful, but I don’t have words - people make confessions about it , workshops, prez on 56 pages of type Demystifying Shapeless . And all this why? To pick out the type of value at compile time, bro.

Fuck, yes, I programmed in 95 at Delpi and I had it all at once. I didn’t know anything about Polymorphic typed λ-calculus, and even now I don’t know anything, but here’s the trick that any schoolchild will write such a HList in 10 minutes, and he will know the type in runtime, and refer to it, and compare and hell knows what else. And do not even think about how to do it all. If there were macros and generics in Delph, I’m sure that students would write exactly the same as all this elite write on Scala, but only orders of magnitude faster than these uncles, and didn’t even think that they need structural refinement types and other crap (is it really necessary?). Life has confirmed this to me, about which later. Yes, by the way, this school code in production would also work orders of magnitude faster — the old school in Borland could do things.

In the general summary on Scala is - the dudes decided to hide the complexity of the tasks in the tool, replacing it with the complexity of using the tool. As a result, it turned out to be more difficult - the dick knows it, for me, the complexity of Scala programming greatly exceeds the benefits of its use. By analogy with the machines - this is the first version of Google-mobile. Wires, all garbage, cameras need to hang out, patch all the fuck, well, and sometimes you can let go of the steering wheel, but do not lower the eyes from the instruments. And if something broke, until one day you figure it out to go further. Yeah, and stalls when the red ball sees. In the furnace.

Farewell to the beloved world of JVM, I did not find what I was looking for.



In short, I rummaged through JVM-based stories, my favorite Fantom did not suit me for a number of reasons , I occasionally looked at Ceylon and Kotlin. All stories with dynamic typing also reject (just do not advise me core.typed). Again, from frustration, TeaVM thought to look, which would expand the list of candidates but did not reach, because I did not see the candidates. In short, all these are things of the same class - such Ford Focus programming languages, driving in traffic jams is good, but you can't say wow.

Having found nothing in the JVM world, I went all the way. Touched the bitch all that at least as it is on hearing, and even something that is not at all on hearing. From the little-known to me - Clay . He had potential, I think. Worthy language is such a statically typed version of Julia. The creators of the language abandoned, as I understood one of the authors is now at Apple and has something to do with Swift.

But today I don’t have time to write about it. Until the next part .

Source: https://habr.com/ru/post/259841/


All Articles