Live data from Hacker News

T-Ruby is Ruby with syntax for types

type-ruby.github.io

71–80 of 155 posts

Re: T-Ruby is Ruby with syntax for types

#71

def greet(name: String): String "Hello, #{name}!" end Yep - looks like utter s... I understand that many programmers come from languages where their brain has been adjusted to necessitate and depend on types. And they get help from the compiler in capturing some errors. But it is the wrong way to think about programs and logic. I'd wish these guys would stop trying to ruin existing languages. Go add types somewhere e…

I'm sad you're getting downvoted. This is objectively uglier Ruby code. Ruby is a gorgeous language, and aesthetics is seemingly not allowed in the conversation.

I'm not convinced that the time savings of types exist at all, but even if it took twice as long to do anything with types, there is a completely valid argument that "it's worth it to look at nicer code".

Re: T-Ruby is Ruby with syntax for types

#72

Honest question: I like typescript and I think it makes sense:, the web makes you married to JavaScript, so it’s the reasonable path forward if you want types in that context. But what is the point of the recent wave of types for python, Ruby, and similar languages? If it’s type safety you want there, there’s a bajillion other languages you can use right?

Type free languages like Lisp, Python and Ruby have faster software development times than languages that use types. The developers who are using the statically typed languages, which are slower to develop in, with are being pushed to use the faster languages. But those developers don't know how to code in type free languages. So they attempt to add the types back in. This of course reduces the software development s…

You are comparing apples to oranges, and go is pretty strong typed

Re: T-Ruby is Ruby with syntax for types

#73
post #65
post #31

Earlier quoted context omitted.

This is our experience. We have added Sorbet to a 16 year old Rails app. It is a big win in avoiding errors, typos, documentation, code completion, fewer tests are required, etc. And the LLMs take advantage of the types through the LSP and type checking.

I’d love to hear from you or someone in your shoes: what are some patterns or examples of tests that are made redundant by types? “It has a field of type X” has never been a useful test for me, my tests are always more like: “if I send message X I get return value or action Y” … with my admittedly limited experience of types I don’t see how they replicate this. Therefore it looks like I’d only be “replacing” tests th…

One of the big advantages of types is documenting what is *not* allowed. This brings a clarity to the developers and additionally ensure what is not allowed does not happen.

Unit tests typically test for behaviours. This could be both positive and negative tests. But we often test only a subset of possibilities just because how people generally think (more positive cases than negative cases). Theoretically we can do all those tests with unit testing. But we need to ask ourselves honestly, do we have that kind of test coverage as SQLLite? If yes, do we have that for very large codebases?

Re: T-Ruby is Ruby with syntax for types

#74

def greet(name: String): String "Hello, #{name}!" end Yep - looks like utter s... I understand that many programmers come from languages where their brain has been adjusted to necessitate and depend on types. And they get help from the compiler in capturing some errors. But it is the wrong way to think about programs and logic. I'd wish these guys would stop trying to ruin existing languages. Go add types somewhere e…

This could be interesting, but do you have arguments other than "stop ruining muh languages" or "u r dumb"?

Re: T-Ruby is Ruby with syntax for types

#75

Honest question: I like typescript and I think it makes sense:, the web makes you married to JavaScript, so it’s the reasonable path forward if you want types in that context. But what is the point of the recent wave of types for python, Ruby, and similar languages? If it’s type safety you want there, there’s a bajillion other languages you can use right?

If you don’t specify types explicitly they have to still exist somewhere: in someone’s head (in oral tradition of “Ah, yea, those IDs are UUIDs, but not those - those are integers”), or denoted through some customary syntax (be it something more formal like Hungarian notation, or less so - suggestive suffixes, comments, supplementary documents).

They still exist at runtime, and people who work on the codebase need to somehow know what to expect. Having a uniform syntax helps to formalize this knowledge and make it machine understandable so it can assist developers by providing quick hits and preventing mixups automatically (saving attention/time for other matters).

Types may be rarely important for local variables, but they matter for API contracts.

Re: T-Ruby is Ruby with syntax for types

#76

Honest question: I like typescript and I think it makes sense:, the web makes you married to JavaScript, so it’s the reasonable path forward if you want types in that context. But what is the point of the recent wave of types for python, Ruby, and similar languages? If it’s type safety you want there, there’s a bajillion other languages you can use right?

It's a way to dig yourself out of the hole without a full rewrite, and with a smaller retraining effort for your developers.

Re: T-Ruby is Ruby with syntax for types

#77

Honest question: I like typescript and I think it makes sense:, the web makes you married to JavaScript, so it’s the reasonable path forward if you want types in that context. But what is the point of the recent wave of types for python, Ruby, and similar languages? If it’s type safety you want there, there’s a bajillion other languages you can use right?

Type free languages like Lisp, Python and Ruby have faster software development times than languages that use types. The developers who are using the statically typed languages, which are slower to develop in, with are being pushed to use the faster languages. But those developers don't know how to code in type free languages. So they attempt to add the types back in. This of course reduces the software development s…

This is junk. Writing a type annotation takes basically zero time, then saves you time by preventing the runtime error because you forgot which variable was which, then saves you more time by autocompleting the correct list of valid methods when you hit dot.

Acting like Go is comparable to JS is ridiculous; Go's type system is the only kind of type system needed in Ruby. Rust is a staggering outlier in complexity. And the Turborepo port took a long time specifically because they tried to port one module at a time with C interop between the old and new codebases, which massively slows down development in any language, especially Go. This is just about the most dishonest 'example' you could have picked.

Either that or you are saying 'weakly typed' to mean type inference in `var := value`, in which case (a) Rust has that too and (b) that's not what the debate is about, nobody is against that

Re: T-Ruby is Ruby with syntax for types

#78

def greet(name: String): String "Hello, #{name}!" end Yep - looks like utter s... I understand that many programmers come from languages where their brain has been adjusted to necessitate and depend on types. And they get help from the compiler in capturing some errors. But it is the wrong way to think about programs and logic. I'd wish these guys would stop trying to ruin existing languages. Go add types somewhere e…

I'm sad you're getting downvoted. This is objectively uglier Ruby code. Ruby is a gorgeous language, and aesthetics is seemingly not allowed in the conversation. I'm not convinced that the time savings of types exist at all, but even if it took twice as long to do anything with types, there is a completely valid argument that "it's worth it to look at nicer code".

I want to agree, but in this current form, gp comes off as an emotional gatekeeper rather than someone with valid points. I think there are strong arguments for both sides. One off scripts with types is bs. Glue code with types, almost bs. Code close to the wire, typing those can be a pain with no gains. But business logic? Large code bases? You can pry* types from my cold dead hands.

Re: T-Ruby is Ruby with syntax for types

#79

Earlier quoted context omitted.

Type free languages like Lisp, Python and Ruby have faster software development times than languages that use types. The developers who are using the statically typed languages, which are slower to develop in, with are being pushed to use the faster languages. But those developers don't know how to code in type free languages. So they attempt to add the types back in. This of course reduces the software development s…

You are comparing apples to oranges, and go is pretty strong typed

I'm comparing a program with itself.

Go only has basic types and interfaces to emulate duck typing (structural typing). The type complexity in Go is rather on the low side of things.

Re: T-Ruby is Ruby with syntax for types

#80

On Firefox, newlines in code blocks are broken for this website. This causes the page to scroll horizontally to accommodate all the code blocks. The code is all wrapped in a single line.

Not on Firefox Android. Either they already fixed the problem or it's OK here. I didn't check with Firefox on desktop yet (Linux).
Post reply on HN