News for hackers. Stuff that matters.
Re:Where is Ruby Headed in 2021? by Mikeb85 on Thursday November 18, 2021 @09:50PM (#29273238)
The static languages I've used most are actually Haskell and recently Pony (mostly for things that involve a bunch of maths and processing in parallel). Just brought Go/Java up because it seems everyone is trying to turn every language into those.

I don't want Ruby to become another TS because I'd use a typed language if I wanted one. The problems I use Ruby for don't need the speed of a statically typed language and it's nice using a dynamic one for.

Re:Where is Ruby Headed in 2021? by abstract_put on Thursday November 18, 2021 @10:36PM (#29273524)
I think what the parent comment is saying (that I agree with) is that it's easy to over-estimate the cost and under-estimate the value. You don't _have_ to do anything with types, but it's another tool to use where it makes sense. Or put another way, provided it's not mandatory what's the downside to having another tool in the toolbox?
Re:Where is Ruby Headed in 2021? by Mikeb85 on Thursday November 18, 2021 @10:46PM (#29273590)
The downside is the ecosystem turning into the JS/TS ecosystem. Where the zealots have pushed TS to the point it all just looks like C# and what makes JS nice is being lost.
Re:Where is Ruby Headed in 2021? by abstract_put on Thursday November 18, 2021 @11:40PM (#29273904)
Do you have any specific examples of things that make JS nice that have been lost because of the popularity of TS? As with types in Ruby, I was under the impression nothing was really lost as TS could be added incrementally as developers saw value.

I don't think I've talked to anyone who has gotten "over the hump" with TS and felt like they were missing something from JS - I may be in a bubble though. It's almost frustratingly beloved in my experience.

Re:Where is Ruby Headed in 2021? by fiddlerwoaroof on Friday November 19, 2021 @12:18AM (#29274071)
I’ve been writing TS for a year now and I find TS annoying. Especially for react components with state management of some kind, the types get so complex you almost need unit tests to assert they are what you think they are. Additionally, TS being a structural type system with no access to nominal types at all eliminates a whole class of “ghosts of departed proofs” modeling techniques. (And, I know you can work around this, but those workarounds are ugly.)

My view is that I’d use TS if I have to but I’d pick either plain JS / CLJS or something like purescript if I really wanted types.

Re:Where is Ruby Headed in 2021? by arcanon on Friday November 19, 2021 @01:04AM (#29274308)
The year is 2021.

People argue for a toolchain that takes a static language, compiles it to a dynamic one, then runs it with an interpreter on the server side.

Humanity ended shortly thereafter.

Re:Where is Ruby Headed in 2021? by jamil7 on Friday November 19, 2021 @04:11AM (#29275257)
I haven’t touched the ecosystem really for a number of years but my last JS project was in TS and I hated it for the same reason. The overhead of bringing in yet more npm modules and types and build steps for questionable levels type safety. Languages with much better type systems exist.
Re:Where is Ruby Headed in 2021? by canaus on Friday November 19, 2021 @10:03AM (#29277878)
Such as?
Re:Where is Ruby Headed in 2021? by zerocount on Friday November 19, 2021 @03:54AM (#29275169)
The dynamic nature of JavaScript is lost when using TypeScript.

Although TypeScript can be added incrementally, in practice I've only seen it totally replace JavaScript.

While I do believe more people prefer TypeScript over JavaScript, I think it's because those people never deep dived JavaScript or bothered to learn it enough to see how powerful it really is. There are also people that just prefer typed languages and will shun languages without static types.

This really is a religious war and boils down to one's opinion. I like JavaScript without typing.

Re:Where is Ruby Headed in 2021? by regularfry on Friday November 19, 2021 @10:01AM (#29277847)
Once you have more than one team in the same codebase the opinions start to line up as people start to think the types will save them from stepping on each others' toes. Which it might! Publishing types is also a poor-man's contract testing, so people who like that sort of thing will like that sort of thing.
Re:Where is Ruby Headed in 2021? by eropple on Friday November 19, 2021 @01:57PM (#29280863)
I have implemented a JavaScript virtual machine. I feel confident in my knowledge of JavaScript as a language and as an operating environment.

What power am I no longer able to leverage using TypeScript when it's appropriate to do so?

Re:Where is Ruby Headed in 2021? by joelbluminator on Friday November 19, 2021 @07:17AM (#29276428)
Why the downvoting? You somehow upset the typed mob I guess...
Re:Where is Ruby Headed in 2021? by fastball on Thursday November 18, 2021 @11:36PM (#29273889)
1. What's wrong with C#?

2. What made JS uniquely nice?

I wanted to leave these questions entirely open to answer, but I'll add my own opinion on (2) because I feel compelled: nothing, JS is quite possibly the worst language ever designed. Certainly the worst in widespread use.

Re:Where is Ruby Headed in 2021? by zarzavat on Friday November 19, 2021 @02:52AM (#29274841)
Why is JS one of the worst languages ever designed? I've used many languages and JS is one of the better designed ones in my opinion.
Re:Where is Ruby Headed in 2021? by tonyedgecombe on Friday November 19, 2021 @03:37AM (#29275069)
>Why is JS one of the worst languages ever designed?

Implicit type conversions.

Function scoping.

Null and undefined, what is the difference?

Accessing an undefined variable doesn't throw an exception.

Assigning to an undefined variable without var puts it in the global scope.

No integer type.

I could go on and on. The only reason it has become successful is because it has a monopoly in the browser.

Re:Where is Ruby Headed in 2021? by mypalmike on Friday November 19, 2021 @07:25AM (#29276468)
My favorite recent discovery is calling a js function with too many or too few parameters. It'll just go ahead and do it.
Re:Where is Ruby Headed in 2021? by phyrex on Friday November 19, 2021 @10:00AM (#29277841)
There’s an implicit “arguments” function argument through which you can access the extra parameters. It’s JSs way of function overloading
Re:Where is Ruby Headed in 2021? by tonyedgecombe on Friday November 19, 2021 @12:13PM (#29279554)
Which looks like an array but isn't.
Re:Where is Ruby Headed in 2021? by phyrex on Friday November 19, 2021 @01:28PM (#29280557)
There’s a lot of that kind of thing in JS, isn’t there? :(
Re:Where is Ruby Headed in 2021? by handrous on Friday November 19, 2021 @11:57AM (#29279308)
I'd add

- Actually using any of the distinguishing features of prototypical inheritance is nearly always a bad idea, which makes the use of that model in the first place very questionable. One of the cornerstones of the language is pretty much one big foot-gun, to be wholly avoided.

Re:Where is Ruby Headed in 2021? by mypalmike on Friday November 19, 2021 @07:22AM (#29276456)
What is [] + [] in JavaScript?
Re:Where is Ruby Headed in 2021? by regularfry on Friday November 19, 2021 @10:03AM (#29277871)
There is the kernel of a nice idea in JS but so many bad early design decisions can never be walked back.
Re:Where is Ruby Headed in 2021? by eropple on Friday November 19, 2021 @06:59PM (#29284232)
I would argue that TypeScript does yeoman's work in doing much of that walking back.

I plumb forgot that assigning a variable without `var` or `let` put it in the global scope because TypeScript yells at you for it.

Re:Where is Ruby Headed in 2021? by lucideer on Friday November 19, 2021 @07:00AM (#29276328)
> I'd use a typed language if I wanted one.

I think the general point the above commenter is trying to make is that not all typed languages are equivalent: i.e. if you're avoiding TS/typed ruby/etc. because you don't want something like Haskell/Java, then that's not a well-informed decision as they're (all) radically different approaches to static typing, each with their own unique benefits and drawbacks.

TS is nothing like Java nor Haskell. Nor Rust.

(I can't personally speak to Ruby/Pony yet)

Re:Where is Ruby Headed in 2021? by JBits on Friday November 19, 2021 @12:59AM (#29274289)
Wait, Pony as in https://www.ponylang.io/ ? Since this is the first time I've seen someone bring it up, can I what your experience using it has been like? And also what you were using it for?
Re:Where is Ruby Headed in 2021? by Mikeb85 on Friday November 19, 2021 @10:38AM (#29278262)
That's the one. Experience is that it's very good at what it does: multithreaded/distributed programs. Good C interop. It forces you into it's paradigm, but it's a good one for creating performant code across cores.

Tooling isn't great, it's missing things like a language server (compiler gives good error messages at least), but it's also quite simple (whole syntax fits into a smallish page) and the documentation is decent.

Playing around with it for doing economic simulations. Actors + good multithreaded performance = pretty much perfect for the domain. Makes sense too, the creator and half the core members came from the financial field.

Ruby is my go-to for scripting, one off programs, and anything web-related (blog, putting together a small crud site). For things where I want performance, I just use a compiled/static language.

Re:Where is Ruby Headed in 2021? by imachine1980_ on Thursday November 18, 2021 @10:39PM (#29273539)
you don't use static type for speed, the first time i write some code in TS(wh compile to js) i typed something of web-storage the editor say this function assume string and you put a num, if i use js i need to run the program to know that. is cool ultra expressive typing(haskell) but you don need nothing so fancy to have huge gains in productivity. ruby and python are grate langues to write scripts and rails make a lot for you but having the compiler take your hand slaps bugs like nothing