I'm new to using Ruby and this tickled me pink
-
People still use ruby?
I had a coworker choose RoR for a major project despite the fact that he didn't know it, nobody on his team knew it, nobody at our company knew it, and nobody in the entire state knew it. It ended as one would expect, after three years and millions of dollars spent, with the only revenue it generated being $50K from the original client that had to be refunded to avoid a lawsuit.
-
This post did not contain any content.
How are the dataframe libraries on Ruby?
-
This type checking, is it at run time?
Its AOT compiled.
-
People still use ruby?
-
I'm gonna be honest, I never was drawn to python. I've been a professional developer for about a decade, and I've written all of one (1) python programs that I can remember (for my own personal use, mind).
What you can achieve in a couple of pages of Python can be pretty spectacular. It's also mostly very easy-to-read, with the possible exception of class inheritance, which is confusing mess.
If you need to write more than a couple of pages, then its lack of types becomes a hindrance to me - doing refactors when functions can take basically any arguments is quite painful, for instance. Not requiring any particular structure is great, up until you start to struggle with lack of structure.
Ideal programming language for when you're wanting to do something that would be a bit too unwieldy for a shell script. It also makes network requests and json parsing very straightforward, so it's great for interacting with REST APIs and writing simple microservices. Fast to write and runs quite quickly, so a good choice for Advent Of Code-like tasks. Would probably choose a different language for larger projects or when working in a team, though.
-
This post did not contain any content.
365.25, surely
-
This post did not contain any content.
Fuck that. I once used a constraint solver in python where you could
+=
a constraint to a problem. This is completely un-discoverable. In any sane language you can use IntelliSense to find that you canproblem.
…add(constraint)
and be done with it without ever touching a manual. Overloaded operators are cool, but a menace.And while I’m ranting: Angular’s new
addRouting(), withThingA(), withThingB()
is complete horseshit, too. The old way of doingaddRouter({
and letting the IDE tell you what you could to with the router was so much clearer! -
The Python won't give an accurate date here because it doesn't take into account leap years.
timedelta
marks time in days, seconds, and microseconds. It doesn't take leap years into account because the concept of years is irrelevant totimedelta
. If you need to account for leap years, you need a different API. -
What you can achieve in a couple of pages of Python can be pretty spectacular. It's also mostly very easy-to-read, with the possible exception of class inheritance, which is confusing mess.
If you need to write more than a couple of pages, then its lack of types becomes a hindrance to me - doing refactors when functions can take basically any arguments is quite painful, for instance. Not requiring any particular structure is great, up until you start to struggle with lack of structure.
Ideal programming language for when you're wanting to do something that would be a bit too unwieldy for a shell script. It also makes network requests and json parsing very straightforward, so it's great for interacting with REST APIs and writing simple microservices. Fast to write and runs quite quickly, so a good choice for Advent Of Code-like tasks. Would probably choose a different language for larger projects or when working in a team, though.
I like Fish Shell better than python, not gonna lie. Easier to read and write. Especially if you already live in the terminal.
-
Yeah I was also pleasantly surprised having only heard about it before. Lots of good stuff
I haven't used or read about PHP after college, and I am quite interesred in what are the good stuffs that you like now.
It is cool to see how languages evolve.
-
I haven't used or read about PHP after college, and I am quite interesred in what are the good stuffs that you like now.
It is cool to see how languages evolve.
I haven’t used php before and I am not that far into it yet, so I don’t really know what’s gotten better but I like how it handles arrays and it has loads of little functions that make life easier.
-
The Python won't give an accurate date here because it doesn't take into account leap years.
The comparison is somewhat awkward, because the rails example presumably produces a date, while the python one is referring to an interval of time.
Just from the meme it's not obvious which was the actual intended use, so labeling either as inaccurate requires us to make assumptions.Personally, the concept of "10 years ago" is a bit nebulous to me. If today is February 29th, is ten years ago March 1st? Doesn't seem right. Or particularly useful.
-
LLM is saying this is a feature of Rails and not particularly Ruby.
I was surprised Python didn’t have a years parameter but learned about
relativedelta(years=10)
wrote last edited by [email protected]Rails, ActiveSupport I believe, adds this to integers.
But I think one of the interesting things about it is the open nature of classes in ruby.
The thing that makes it possible is that you can open classes in user space and just add stuff to them. It’s a neat feature that few languages have.
The feature, like most features, has pros and cons. On the pro side it makes making DSLs and helpers like this pretty trivial. You can make really expressive ideas and apis because you can change how things you didn’t write work.
On the con side, it’s harder to discover and the methods of an object being the result of runtime mixins can make things hard to reason about.
Having worked in both python and ruby and now elixir for the past couple of years, it’s interesting to see how the languages are similar and different.
There’s an elegant beauty to ruby’s everything is an object and all method calls are messages concept. Python has always struck me as less elegant but the upside is that it can model different ideas in different ways and doesn’t have to try to make them all look like the one central idea.
Even though I find the model behind ruby more pleasing to think about, I tend to enjoy python more due to it being more explicit and easier to reason about. Although that’s pretty subjective.
In any case I think the language feature of open classes is a fascinating one and one of the really different parts of ruby that really distinguishes it from python, for better or worse.
-
Fuck that. I once used a constraint solver in python where you could
+=
a constraint to a problem. This is completely un-discoverable. In any sane language you can use IntelliSense to find that you canproblem.
…add(constraint)
and be done with it without ever touching a manual. Overloaded operators are cool, but a menace.And while I’m ranting: Angular’s new
addRouting(), withThingA(), withThingB()
is complete horseshit, too. The old way of doingaddRouter({
and letting the IDE tell you what you could to with the router was so much clearer!Any good inline help would run dir into your variable and discover it overloads that operator. It's a fault of your tools.
-
365.25, surely
Never use numbers when calculating dates. Use the data formats and constants the calendar library provides.
-
This post did not contain any content.
I'm surprised this post hasn't summoned perl devs yet... 🤨
-
This post did not contain any content.wrote last edited by [email protected]
Ok, everyone who's ever had to use datetime hates it, but not because it's insufficient, but because international date/time is such a nightmare that the library must be complicated enough to support all the edge cases I'm convinced that library has a function for traveling trough time.
For years I've wrapped datetime with custom functions that do exactly and only what I want to mitigate its all-plumbing-zero-porcelain approach to the problem.
-
Fuck that. I once used a constraint solver in python where you could
+=
a constraint to a problem. This is completely un-discoverable. In any sane language you can use IntelliSense to find that you canproblem.
…add(constraint)
and be done with it without ever touching a manual. Overloaded operators are cool, but a menace.And while I’m ranting: Angular’s new
addRouting(), withThingA(), withThingB()
is complete horseshit, too. The old way of doingaddRouter({
and letting the IDE tell you what you could to with the router was so much clearer!wrote last edited by [email protected]I'll take overloaded operators over overloaded functions any day of the week, and I also hate overloaded operators.
Python's optional typing has come a very long way in the past few years, you might be able to mitigate this with some creative application of typing.
Edit: I read your post closer, I'm not sure typing would help with the overloaded operator issue and now I have something fun to try out later
-
365.25, surely
365.2425
-
The comparison is somewhat awkward, because the rails example presumably produces a date, while the python one is referring to an interval of time.
Just from the meme it's not obvious which was the actual intended use, so labeling either as inaccurate requires us to make assumptions.Personally, the concept of "10 years ago" is a bit nebulous to me. If today is February 29th, is ten years ago March 1st? Doesn't seem right. Or particularly useful.
yeah, that's pretty much why timedelta doesn't have the concept of months or years, just days and smaller units. I like it better this way.