Live data from Hacker News

Rue: Higher level than Rust, lower level than Go

rue-lang.dev

211–220 of 274 posts

Re: Rue: Higher level than Rust, lower level than Go

#211

Earlier quoted context omitted.

C was designed as a high level language and stayed so for decades

> C was designed as a high level language and stayed so for decades C was designed as a "high level language" relative to the assembly languages available at the time and effectively became a portable version of same in short order. This is quite different to other "high level languages" at the time, such as FORTRAN, COBOL, LISP, etc.

When C was invented, K&R C, it was hardly lower level than other systems programming languages that predated it, since JOVIAL in 1958.

It didn't not even had compiler intrisics, a concept introduced by ESPOL in 1961, allowing to program Burroughs systems without using an external Assembler.

K&R C was high level enough that many of the CPU features people think about nowadays when using compiler extensions, as they are not present in the ISO C standard, had to be written as external Assembly code, the support for inline Assembly came later.

Re: Rue: Higher level than Rust, lower level than Go

#212
post #200

Earlier quoted context omitted.

They presumably mean tagged unions like `User = Guest | LoggedIn(id, username)`.

That wouldn't explain C, then, which does not have sum types either. All three languages do have enums (as it is normally defined), though. Go is only the odd one out by using a different keyword. As these programs were told to be written as carbon copies of each other, not to the idioms of each language, it is likely the author didn't take time to understand what features are available. No enum keyword was assumed t…

C has numeric enums and tagged unions, which are sum types without any compile time safety. That’s idiomatic C.

Go doesn’t have any equivalent. How do you do stuff like this in Go, at all?

I’ve been programming for 30+ years. Long enough to know direct translations between languages are rarely beautiful. But I’m not an expert in Go. Maybe there’s some tricks I’m missing?

Here’s the problem, if you want to have a stab at it. The code in question defines a text editing operation as a list of editing components: Insert, Delete and Skip. When applying an editing operation, we start at the start of the document. Skip moves the cursor forward by some specified length. Insert inserts at the current position and delete deletes some number of characters at the position.

Eg:

    enum OpComponent {
        Skip(int),
        Insert(String),
        Delete(int),
    }

    type Op = List
Then there’s a whole bunch of functions with use operations - eg to apply them to a document, to compose them together and to do operational transform.

How would you model this in Go?

Re: Rue: Higher level than Rust, lower level than Go

#213

I don't need lower level than go. I just really like Rust' type system and error handling and I want it in a compiled language. Zero Cost abstractions and it's memory model is fascinating - but isn't particularly useful for the part of the tech stack I work on.

i see a lot of go hatred on HN but coming from c i actually kind of love go when i need just enough abstracted away from me to focus on doing a thing efficiently and still end up with a well-enough performing binary. i have always been obsessed with the possibility of building something that doesn't need me to install runtimes on the target i want to run it, it's just something that makes me happy. very rarely do i need to go lower than what go provides and when i do i just.. dip into c where i earned a lot of my stripes over the years.

rust is cool. a lot of really cool software im finding these days is written in rust these days & i know im missing some kind of proverbial boat here. but rusts syntax breaks my brain and makes it eject completely. it's just enough to feel like it requires paradigm shifts for me, and while others are really good at hopping between many languages it's just a massive weakness of mine. i just cant quite figure out the ergonomics of rust so that it feels comfy, my brain seems to process everything through a c-lens and this is just a flaw of mine that makes me weak in software.

golang was started by some really notable brains who had lots of time in the game and a lot of well thought out philosophies of what could be done differently and why they should do it differently coming from c. there was almost a socio-economic reason for the creation of go - provide a lang that people could easily get going in and become marketable contributors that would help their career prospects. and i think it meets that mark, i was able to get my jr engineers having fun in golang in no time at all & that's panned out to be a huge capability we added to what our team can offer.

i like the objective of rue here. reviewing the specification it actually looks like something my brain doesn't have any qualms with. but i dont know what takes a language from a proposal by one guy and amplifies it into something thats widely used with a great ecosystem. other minds joining to contribute & flesh out standard libraries, foundations backing, lots of evangelism. lots of time. i won't write any of those possibilities off right now, hopefully if it does something right here there's a bright future for it. sometimes convincing people to try a new stack is like asking them to cede their windows operating system and try out linux or mac. we've watched a lot of languages come and go, we watch a lot of languages still try to punch thru their ceilings of general acceptance. unlike some i dont really have huge tribalistic convictions of winners in software, i like having options. i think it's pretty damn neat that folks are using their experiences with other languages to come up with strong-enough opinions of how a language should look and behave and then.. going out and building it.

Re: Rue: Higher level than Rust, lower level than Go

#214

How does this differ from Hylo [0]? [0] https://hylo-lang.org

I am very interested in Hylo! I think they're playing in similar spaces. I'd like to explore mutable value semantics for Rue. One huge difference is that Hylo is using LLVM, whereas I'm implementing my own backends. Another is that Hylo seems to know what they want to do with concurrency, whereas I really do not at all right now. I think Hylo takes a lot of inspiration from Swift, whereas I take more inspiration from…

How are Swift and Rust very similar? I can search, but want to hear your opinion.

And congrats on starting a language project, even if Just for Fun (Linux). ;)

https://frappe.io/blog/book-reviews/just-for-fun-a-book-on-l...

Re: Rue: Higher level than Rust, lower level than Go

#215
post #205

Earlier quoted context omitted.

A) you cannot tell B) you have said nothing productive toward discussion, you’ve just accused someone of using a tool (that you don’t know if they used) I’d prefer actual criticism of the content. (I cannot downvote and would not if I could)

I am certain that they used a tool. As I said, I normally do not complain and typically engage on the merits -- but these have been among the top comments on every front page article I've read today and it gets tiresome! To me, if you cannot invest enough effort to remove the pretty obvious cues, why am I investing the effort in reading the comment? After seeing your reply, I looked at their comment history which mak…

that is fair —- you’re claiming this person has a pattern of lazy, low-effort comments. I didn’t check and if you’re right, I appreciate you calling it out

just as you’re annoyed by low-effort LLM posts/comments, I’m annoyed by low-effort “this sounds like it was written by ChatGPT” comments (hence my response and at least a possible explanation of downvotes)

edit: I also scrolled through, you’re absolutely right! it does look like a low-effort bot

Re: Rue: Higher level than Rust, lower level than Go

#216
"Memory Safe No garbage collector, no manual memory management. A work in progress, though."

I wish them the best, but until they have a better story here I'm not particularly interested.

Much of the complexity in Rust vs simplicity in Go really does come down to this part of the design space.

Rust has only succeeded in making a Memory Safe Language without garbage collection via significant complexity (that was a trade-off). No one really knows a sane way to do it otherwise, unless you also want to drop the general-purpose systems programming language requirement.

I'll be Very Interested if they find a new unexplored point in the design space, but at the moment I remain skeptical.

Folks like to mention Ada. In my understanding, Ada is not memory safe by contemporary definitions. So, this requires relaxing the definition. Zig goes in this direction: "let's make it as safe as possible without being an absolutist"

Re: Rue: Higher level than Rust, lower level than Go

#217

"Memory Safe No garbage collector, no manual memory management. A work in progress, though." I wish them the best, but until they have a better story here I'm not particularly interested. Much of the complexity in Rust vs simplicity in Go really does come down to this part of the design space. Rust has only succeeded in making a Memory Safe Language without garbage collection via significant complexity (that was a tr…

If you look at the Github, there's a design proposal (under docs/design) for that.

It looks like the idea at the present time is to have four modes: value types, affine types, linear types, and rc types. Instead, of borrowing, you have an inout parameter passing convention, like Swift. Struct fields cannot be inout, so you can't store borrowed references on the heap.

I'm very interested in seeing how this works in practice--especially given who is developing Rue. It seems like Rust spends a lot of work enabling the borrow checker to be quite general for C/C++-like usage. E.g. you can store a borrowed reference to a struct on the stack into the heap if you use lifetime annotations to make clear the heap object does not outlive the stack frame. On the other hand it seems like a lot of the pain points with Rust in practice are not the lifetime annotations, but borrowing different parts of the same object, or multiple borrows in functions further down the call stack, etc.

Re: Rue: Higher level than Rust, lower level than Go

#218

Any tentative ideas yet as to how you will manage the memory management? Sounds like a sort of magic 3rd way might be in the making/baking!

Something in the area of linear types and mutable value semantics.

Anything out there for reference or would you be implementing from theory/ideas here? God speed to you in terms of the project overall, it's exciting to see the beginnings of a rust-like-lang without the headaches!

Re: Rue: Higher level than Rust, lower level than Go

#219
post #200

Earlier quoted context omitted.

That wouldn't explain C, then, which does not have sum types either. All three languages do have enums (as it is normally defined), though. Go is only the odd one out by using a different keyword. As these programs were told to be written as carbon copies of each other, not to the idioms of each language, it is likely the author didn't take time to understand what features are available. No enum keyword was assumed t…

C has numeric enums and tagged unions, which are sum types without any compile time safety. That’s idiomatic C. Go doesn’t have any equivalent. How do you do stuff like this in Go, at all? I’ve been programming for 30+ years. Long enough to know direct translations between languages are rarely beautiful. But I’m not an expert in Go. Maybe there’s some tricks I’m missing? Here’s the problem, if you want to have a stab…

> C has numeric enums and tagged unions

C has unions, but they're not tagged. You can roll your own tagged unions, of course, but that's moving beyond it being a feature of the language.

> How would you model this in Go?

I'm committing the same earlier sin by trying to model it from the solution instead of the problem, so the actual best approach might be totally different, but at least in staying somewhat true to your code:

    type OpComponent interface { op() }
    type Op = []OpComponent

    type Skip struct { Value int }
    func (s Skip) op() {}
    type Insert struct { Value string }
    func (i Insert) op() {}
    type Delete struct { Value int }
    func (d Delete) op() {}

    op := Op{
        Skip{Value: 5},
        Insert{Value: "hello"},
        Delete{Value: 3},
    }
Post reply on HN