News for hackers. Stuff that matters.
Re:A Look at Crystal, the Programming Language for Humans by moe on Friday May 05, 2023 @05:35AM (#35827029)
Go is not a good comparison.

Crystal is expressive, 500 lines of Go commonly translate to 50 lines of Crystal. The DX in Crystal is really closer to Ruby than to Go. It's essentially a very fast and type-safe version of Ruby.

Re:A Look at Crystal, the Programming Language for Humans by pelasaco on Friday May 05, 2023 @06:26AM (#35827389)
> The DX in Crystal is really closer to Ruby than to Go.

Me as polyglot can say that is much easier to switch completely between languages and paradigm than write or talk similar (but not equal) languages. So it is maybe a great reason for beginners to start to play with Crystal as Rubyists, but as soon as you start to work daily with the language, other factors like good documentation, tons of examples, great standard lib, active community and development, etc are much more important than if its remembers ruby or not.

Re:A Look at Crystal, the Programming Language for Humans by straight-shoota on Friday May 05, 2023 @06:34AM (#35827454)
Crystal core developer speaking:

I think this argument is less about the concrete syntactical and semantic similarities to Ruby, but the shared general idea to focus on developer happiness. For example, code is easy to read, yet still expressive.

Re:A Look at Crystal, the Programming Language for Humans by mirekrusin on Friday May 05, 2023 @07:07AM (#35827692)
Maybe with LLMs it won't matter much anymore? Maybe in the near future we'll have copilot for crystal as vscode plugin and the rest doesn't matter much - just quality of this plugin?
Re:A Look at Crystal, the Programming Language for Humans by aatd86 on Friday May 05, 2023 @09:29AM (#35828963)
What will your LLM be trained on?

It only makes the problem even more acute I think.

Re:A Look at Crystal, the Programming Language for Humans by vidarh on Friday May 05, 2023 @11:43AM (#35830732)
Yesterday I told ChatGPT:

> We're going to write a program in a "new" language that is a mix of Ruby and INTERCAL. We're going to take the "come from" statement and use it to allow "hijacking" the return of a function. Furthermore, we're going to do it conditionally. "come from <method> if <condition>" will execute the following block if <method> was executed and <condition> is true. In <condition>, "result" can be used to refer to the result of executing <method>.

And that was enough to get it to understand my example code and correctly infer what it was intended to return.

Given it took that little, I don't think you need much code in a new language before you have a reasonable starting point as long as you can give examples and document the differences, and then use that on a few large projects that has good test suites, and work through any breakage.

Re:A Look at Crystal, the Programming Language for Humans by aatd86 on Friday May 05, 2023 @02:02PM (#35832933)
You still need libraries and the ecosystem.

If it can't find those, then because there is no training data, best case scenario is that it will hallucinate APIs that don't exist.

Re:A Look at Crystal, the Programming Language for Humans by vidarh on Friday May 05, 2023 @02:21PM (#35833187)
If the LLM understands the language it can aid in creation of the libraries and ecosystem because it can also translate code. I just tested it by having ChatGPT translate one of my Ruby scripts to Python for example.

I don't like Crystal all that much, but it's similar enough to Ruby that if ChatGPT can handle Ruby->Python, it can handle Ruby->Crystal with relatively little work.

But it doesn't need to handle it flawlessly, because every new library you translate and fix up gives you a new codebase you can use to finetune it.

Re:A Look at Crystal, the Programming Language for Humans by mirekrusin on Friday May 05, 2023 @02:33PM (#35833385)
We need RLHF -> RLCF/RLIF/RLEF (Reinforcement Learning from Compiler/Interpreter/Execution Feedback).
Re:A Look at Crystal, the Programming Language for Humans by mirekrusin on Friday May 05, 2023 @02:31PM (#35833349)
But that's the thing, libraries are written and it should be able to just read/learn/train on it, that's all.
Re:A Look at Crystal, the Programming Language for Humans by mirekrusin on Friday May 05, 2023 @02:28PM (#35833307)
Ideally on source code so it knows standard library and how to use it with enough comprehension to be useful.
Re:A Look at Crystal, the Programming Language for Humans by yellowapple on Friday May 05, 2023 @11:42AM (#35830717)
At that point, why bother with high-level languages at all? A sufficiently-good AI should be able to read a specification / test suite and directly generate a binary which passes those tests.
Re:A Look at Crystal, the Programming Language for Humans by mirekrusin on Friday May 05, 2023 @02:37PM (#35833437)
Maybe. Or maybe it'll become validation/what-is-happening lowest denominator. Programming languages are also a good Intermediate Language between humans<->machines and machines<->machines apparently due to recent AI advancements.
Re:A Look at Crystal, the Programming Language for Humans by unrealhoang on Friday May 05, 2023 @07:29AM (#35827873)
> 500 lines of Go commonly translate to 50 lines of Crystal

This is a vast exaggeration. And even if I grant it, it's still thousand of loc that you don't have to write because of available libraries.

Re:A Look at Crystal, the Programming Language for Humans by DennisP on Friday May 05, 2023 @08:50AM (#35828557)
Although they do try to make it easy to use C libraries:

https://crystal-lang.org/reference/1.8/syntax_and_semantics/...

Re:A Look at Crystal, the Programming Language for Humans by antifa on Friday May 05, 2023 @12:33PM (#35831665)
IMO crystal's value is that I can do things normally associated with golang without the horrors of actually dealing with golang's absence of a good type system and other quirks like error handling.