News for hackers. Stuff that matters.
Re:Why Crystal Is My Next Language by nlh on Sunday June 10, 2018 @11:07PM (#17281453)
I hear you, and I too love Ruby, and I too have yet to actually need the performance benefits of Crystal. But man, you don't realize how awesome static typing is until you actually start using it. There are whole classes of bugs that just get nixed before the program even runs. It makes you think more about how to structure things, how you're passing arguments, how you use variables, etc.

Now maybe you're really really really good w/ Ruby and you don't make those mistakes anymore, but for an "advanced beginner" like myself, it's really helpful.

Re:Why Crystal Is My Next Language by vinceguidry on Sunday June 10, 2018 @11:30PM (#17281530)
Yeah, I'm not saying it's not useful, and I can't wait to introduce static typing into my own programs and get those benefits. But every time I step away from Ruby I end up missing it more than the other language gives me. And this is after I figure out how the other language does what I'm trying to do.

To me typing is something you don't want until you really want it, until then it's just boilerplate. That "class of bugs that just get nixed" isn't something that starts happening, once you're skilled anyway, until a certain point in the evolution of your application.

There's a lot of code that I add to my Ruby classes that involves type-checking, and it would be nice to lean on a dedicated system for handling type abstractions rather than doing it ad-hoc every time I have to do it. For that reason, I'm greatly looking forward to Ruby's upcoming type system.

Re:Why Crystal Is My Next Language by vidarh on Monday June 11, 2018 @02:51AM (#17282323)
I came to Ruby from 20 years of working in statically typed languages, and I think it largely boils down to how you're used to working. E.g. you need test either way, and properly written tests reveal most of the same typing issues static typing does.

I'd enjoy static typing if I didn't have to sacrifice the flexibility of Ruby, but so far I've yet to see a system with good-enough type inference to make up for the extra ceremony. I hope that will eventually change, but what I've seen of Crystal is not it.

Re:Why Crystal Is My Next Language by tigershark on Monday June 11, 2018 @07:11AM (#17283306)
Which statically typed languages did you use in these 20 years? If you ever used Haskell/OCaml/F# it would seem a pretty strange declaration.
Re:Why Crystal Is My Next Language by crimsonalucard on Sunday June 10, 2018 @11:30PM (#17281533)
He's more beginner then you. Calling ruby the one true language after it's been losing traction for years indicates to me he probably just started.
Re:Why Crystal Is My Next Language by vinceguidry on Sunday June 10, 2018 @11:33PM (#17281546)
I've been coding since I was 9 years old, made my first web page at 15, I'm 34 now, having been a pro web dev for 5 years. I'm no greybeard, but I'm definitely not a beginner. And I stand by my assertion. Programming languages come and go. I've been watching it happen for over a decade. Ruby's the one language that transcends the normal reasons why they do that.

Other languages fit hardware or chosen domains better or worse, those are the reasons why you'd choose one or the other. Ruby's the only language that fits the mind better.

Re:Why Crystal Is My Next Language by dragonwriter on Monday June 11, 2018 @12:38AM (#17281844)
> Ruby's the only language that fits the mind better.

Look, I really like Ruby, too, but the idea that it is the one language that “fits the mind better” and is, for that reason, immune to the normal ebb and flow of language popularity is both amazingly parochial in the first case and empirically false in the last case.

Re:Why Crystal Is My Next Language by vinceguidry on Monday June 11, 2018 @01:02AM (#17281951)
What brought me to that conclusion was my rejection of Scheme. I learned Scheme first, through HtDP, which absolutely blew my mind. I wanted to use Scheme for everything, but instead made the pragmatic choice to learn Ruby so that I could more easily find a job, and just use HtDP concepts in my Ruby programs.

Well after awhile I realized I didn't miss Scheme. Like, at all. I had to really think hard about why. The first insight I had was that, well, syntax really does matter, and the paren-soup just isn't aesthetic.

The second thing I realized was that Ruby's object model is just far more intuitive than any other way of dealing with objects. It's just, well, elegant. Everything's an object, everything has a class. This is what Crystal misses. And it can't because of its static nature, types can't be a class. A certain kind of reflection is impossible.

And this is where static vs. dynamic comes in. Static forces you to write boilerplate. Dynamic lets you write it when you need it. You want dynamic until you want static. It's just that simple. No one is inherently better, they're just better suited to different situations. You want to flow from one to the other, not get handcuffed. This makes dynamic inherently better, because you can build a static type checker on top of a dynamic language, but to put dynamic typing inside a static language is just always going to be a kludge.

If I can get pleasing syntax, an elegant object model, and gradual typing in a language that's also faster than Ruby, I'd jump on it. But every other language makes compromises on these points for one reason or another. Of all three, it seems the object model is the most difficult to implement, but it's one I rely on to get me out of jams. I don't often need metaprogramming, but when I do, it saves me a lot of time. And I've never run into anything else like it save in the Lisps.

If I didn't have Ruby, I'd be using a Lisp. Having metaprogramming available, even if you're not using it, gives a real sense of safety, not against silly bugs, but against the much bigger possibility, of making poor abstractions. In Ruby, once I've realized I've made a bad abstraction, I can take the working code and metaprogram it, keeping behavior working, until it's using the semantics I need from it. This makes me far more confident to just knock up systems as quickly as possible, safe in the understanding that I can turn any semantics into any other semantics when I need to. You can fix the propensity to make type errors in a dynamic language with discipline, but you can't fix the propensity to make wrong abstractions with any amount or kind of discipline that I've ever been able to see.

But I'm also surprised just how much syntax impacts my desire to actually write code. There's something about Ruby's code block delimiters that are more pleasing than either whitespace or bracket delimiters. I don't mind bracket delimiters if the whole block is on one line. But to force me to use brackets for multi-line code blocks, the so-called C syntax, well I don't find it half as aesthetically pleasing as Ruby. Is it just personal preference? Perhaps. But I think a hundred years is going to really clarify everything and languages will lose their utility advantages over each other and so all that's left will be aesthetics. And I think Ruby just has everybody beat in this area.

Re:Why Crystal Is My Next Language by dragonwriter on Monday June 11, 2018 @02:39AM (#17282271)
You point to some interesting aesthetic reasons you prefer Ruby, but aesthetics are highly personal and subjective and simply cannot justify the generalizations you made upthread.

Also:

> Static forces you to write boilerplate.

Not very much, inherently, just most static languages have poor (or no) inference, which forces you to write boilerplate (and often poor type systems, which make some otherwise correct approaches impossible, forcing you to code around the type system on top of writing boilerplate.)

Haskell is kind of eye opening in this regard, in terms of a statically tired language where these problems are minimized compared to most popular static languages.

Re:Why Crystal Is My Next Language by crimsonalucard on Monday June 11, 2018 @11:05AM (#17284846)
As elegant as it is, scheme suffers from the same pitfall as python and ruby: lack of type checking.
Re:Why Crystal Is My Next Language by CrystalLangUser on Monday June 11, 2018 @12:11AM (#17281706)
Good thing Crystal based its syntax off of Ruby then. And it's statically typed, thank god.

I do professional work in Ruby currently, but Crystal is just so much more pleasant to work with.

Re:Why Crystal Is My Next Language by crimsonalucard on Monday June 11, 2018 @11:01AM (#17284804)
You are a beginner. Ruby is a dying language that hit it's high point and died and now is at it's at a low point and not going anywhere. It's time has passed like php and now it's used mostly for devops scripting as the technical debt the language accumulates is generally too high even for web apps.

Python, C++, C, Java and javascript are the languages with staying power that came and never went. If you were in the industry that long you'd know that most of the languages I mentioned have serious issues and problems and that the languages staying power has nothing to do with how they fit the "mind" or how good they are.

If you weren't a beginner you'd also note that ruby, like python and like javascript has serious issues when it comes to writing long lasting, reliable code. To code something as reliable and complex as an operating system in ruby would lead to huge amounts of technical debt. As a ruby or python code base grows in complexity it becomes more and more unmaintainable... It would be a mistake to write super complex systems in python or ruby because such systems benefit highly from type checking. Your comments indicate to me that it doesn't matter how long you've been programming... you lack the experience to understand this concept. Ruby is better for scripting then it is for writing applications.

What I have learned over the years is that programming is more about combatting our own faulty human nature, our own propensity to make mistakes. Ironically, the more expressive a language is, the more it gives, us the opportunity to express this fault. Power comes from restriction. Type checking is one such restriction.

Re:Why Crystal Is My Next Language by vinceguidry on Monday June 11, 2018 @12:09PM (#17285476)
You are offering up your lived experience as wisdom without any rationale as to why I should accept your conclusions over my own. Just an endless cavalcade of "you are a beginner and you lack experience." As such it's falling on deaf ears.
Re:Why Crystal Is My Next Language by crimsonalucard on Monday June 11, 2018 @04:40PM (#17288360)
I don't have the time to explain the logic behind my wisdom. I can only show you the door as my conclusions are avenues you obviously haven't explored. It's up to you whether you want to take the blue pill or the red pill.
Re:Why Crystal Is My Next Language by vinceguidry on Monday June 11, 2018 @06:51PM (#17289309)
As someone who does a great deal of mysticism and dealt with a great number of wannabe teachers, I can easily tell the difference between those who are coming from a position of true knowledge and those who are just protecting fragile ego. Guess which category I have you in.
Re:Why Crystal Is My Next Language by crimsonalucard on Tuesday June 12, 2018 @01:19AM (#17290887)
My guess is you have me in the category of someone protecting a fragile ego. I assure you I am not. The choice is yours. If you want to see the light I recommend that you look into Haskell and spend a non trivial amount of time learning that language. Otherwise I could care less.
Re:Why Crystal Is My Next Language by kjeetgill on Monday June 11, 2018 @12:33AM (#17281818)
That's how I feel about Python. It also feels like it has a unique mental ergonomics.

We're both super biased in that regard; everyone has a language they prefer to think in. Usually a dynamic, malleable one.

Who thought perl would die?

That said, I'm going to agree with sibling comments and give Python one big, big, advantage over Ruby: it's made inroads into a ton more domains such as numerical computing, duct tape programming, bioinformatics, ml/ai etc. It's installed by default in nearly every *nix flavor, mac OS included.

Re:Why Crystal Is My Next Language by vgy7ujm on Monday June 11, 2018 @04:57AM (#17282819)
Perl is no more dead than Ruby at least.
Re:Why Crystal Is My Next Language by hota_mazi on Monday June 11, 2018 @12:18AM (#17281748)
But surely you see that Ruby has been on a steady decline for ten years, and with RoR falling out of grace, that decline is accelerating.
Re:Why Crystal Is My Next Language by vinceguidry on Monday June 11, 2018 @12:39AM (#17281849)
People have been saying that about Ruby for years, but what I look for is whether Ruby stops solving problems better than other languages do.

My own shop has recently made the decision to replatform onto Node, for no real reason that I can discover. Just seemed to be a "oh let's all go learn the new hotness over here and toss away our existing architecture in order to do it. When something I wanted I found out was unmaintained in Ruby, I almost went along whole-heartedly with this new direction. But I've found something even more fundamental that's unmaintained in Node that's got me back in the "just use Ruby, it works and I know it really well" camp.

Faddish behavior on the parts of developers doesn't really concern me. I was never concerned that all my RDBMS knowledge would get tossed into the shitter when Mongo hit the scene. A steady decline doesn't bother me. COBOL has been declining for 30 years, and you can still make a fine living supporting COBOL codebases.

No, devs can do whatever they want, there's always going to be that pragmatic group of engineers that will use Ruby because it's still the best at what it does.

Re:Why Crystal Is My Next Language by vidarh on Monday June 11, 2018 @02:54AM (#17282336)
For me the last decade has been one of seeing steadily increasing demand for my Ruby skills, and I don't do Rails at all.

So if Ruby is "on a steady decline" someone forgot to tell my customers and employers.

Re:Why Crystal Is My Next Language by hota_mazi on Monday June 11, 2018 @12:32PM (#17285757)
Your personal experience doesn't invalidate the claim that Ruby is declining.

COBOL programmers are in hot demand because there are so few left that even the few positions where they are needed outnumbers them.

Look at objective numbers on language popularity, job boards, etc... You'll see that Ruby has pretty much vanished.

Re:Why Crystal Is My Next Language by vidarh on Monday June 11, 2018 @12:52PM (#17286031)
I've never once seen "objective numbers on language popularity".
Re:Why Crystal Is My Next Language by crimsonalucard on Monday June 11, 2018 @11:09AM (#17284878)
You live in a bubble. Look up some numbers. From an empirical standpoint ruby is dying. Of course your anecdotal experience trumps all the numbers so my point is invalid.
Re:Why Crystal Is My Next Language by vidarh on Monday June 11, 2018 @11:13AM (#17284925)
I've seen plenty of numbers, and I see it being talked about less some places, more others. I don't see any evidence that it is dying. I see evidence there's less hype surrounding Rails, which is great, as I don't like Rails. In any case it is irrelevant, as what matters to my use of Ruby is that my "bubble" keeps expanding and paying more, and producing more software that I benefit from. If it's "dying" outside of that, then that's not a problem.

This idea of languages "dying" to me indicates bubbles of your own - if there's one thing we've seen over most of the history of software it is that programming languages have remained incredibly persistent for decades even after they stop being used in new development, and we're certainly nowhere near that point for Ruby.