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?
I have been programming with Ruby for 11 years with most of the time in a professional context. It's my favorite language :). I don't care much for types, but it can be useful with denser libraries where IDE's can assist with writing code. It has been helpful in my professional life with regards to typed Python and Typescript. One potential example that would be interesting is utilizing types for reflection for AI to…
T-Ruby is Ruby with syntax for types
101–110 of 155 posts
Re: T-Ruby is Ruby with syntax for types
#102I've seen some mention Crystal as well, but as far as I know, Crystal has nothing to do with Ruby except sharing similar syntax. Their semantics are completely different. It's not Ruby + types.
Re: T-Ruby is Ruby with syntax for types
#103Worth mentioning is Crystal lang: Ruby, with types!
How alike actually are Ruby and Crystal? I’ve heard the similarity is only skin-deep: similar syntax but quite different semantics. In other words, isn’t describing Crystal as “Ruby with types” similar to describing C++ as “JavaScript with types”?
https://github.com/wouterken/crystalruby
It allows you to call crystallize on a ruby method and then have it recompile with crystal and called over FFI, which is pretty neat.
It would be really cool if this trb syntax could get close to the crystal syntax for method signatures at least.
I'd love to be able to move chucks of hot code to Crystal but leave everything else in ruby for compatibility with existing projects.
Re: T-Ruby is Ruby with syntax for types
#104Earlier quoted context omitted.
Gradual typing is the worse of both worlds. You get the complexity and slower development times of using statically typed languages along with the bad performance of using dynamically typed languages.
Is this based on your experience or is it just an assumption? I only have anecdotes, but it does not reflect your claims, rather the exact opposite. A lot of the boilerplate code doesn’t need to be type annotated, but annotating the main business logic doesn’t take more time and is not more complicated, but instead type annotations help write code that is more clear, more obvious, and it adds some kind of documentati…
As always, no fancy new tech is a substitute for competent project management.
Re: T-Ruby is Ruby with syntax for types
#105Wait, what happens if you want keyword arguments?
Their docs say that something like: `def greet(name: String, greeting: String = "Hello"): String` will work for kwargs with default values — https://type-ruby.github.io/docs/getting-started/understandi...
e.g.
def greet(name: String | "Hello"): String
I know it's all subjective but I think that reads better and it's valid ruby.To be honest low-type with a static analysis tool would be my favourite syntax for this.
Re: T-Ruby is Ruby with syntax for types
#106Re: T-Ruby is Ruby with syntax for types
#107def 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…
Re: T-Ruby is Ruby with syntax for types
#108Dynamic languages have amazing dev speed, but once code matures, slapping some types on that code is just plucking low hanging fruit. It inevitably picks up easy bugs and makes the code easier to read, understand, and maintain.
Ruby has had no good solution to dynamic typing, for reasons well articulated by the linked piece. Honestly, that kept me from writing much Ruby recently. Every line just felt like instant tech debt, short of any sensible pathway to static analysis.
This might just get me writing some Ruby again.
Re: T-Ruby is Ruby with syntax for types
#109Re: T-Ruby is Ruby with syntax for types
#110Wait, what happens if you want keyword arguments?
Their docs say that something like: `def greet(name: String, greeting: String = "Hello"): String` will work for kwargs with default values — https://type-ruby.github.io/docs/getting-started/understandi...
Or wait, found examples that claims to be keyword arguments, but you define them just the same? I'm confused. https://type-ruby.github.io/docs/learn/functions/optional-re...