💾 Archived View for gemini.ctrl-c.club › ~de_alchmst › b-logs › ruby › ptts › 030:caught-up.gmi captured on 2024-07-08 at 23:51:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-26)

🚧 View Differences

-=-=-=-=-=-=-

So i caught up

Now the crystal vesrion does the same thing as the ruby one. I chose to take a bit more object oriented approach and let me tell you, it was not a good idea. It might make some things easier later, but it just took all the fun out of this project for me. It might have alse been that I was just rewriting what I already had working, but my bet is on the OOP. Well, I still want to finish it and I certainly don't wan't to rewrite it again, so let's just hope that adding new features will make it enjoyable again.

don't do OOP kids, it will fuck you up

Since I don't have any new features to to talk about, here are some observations about crystall. Some compared with ruby, some not.

Modules are like instant classes, but need 'self' everywhere.

Method naming is a bit different. in ruby it's .start_with in crystal .starts_with. This is a common pattern.

Files are handled a bit differently. You don't open it to variable and then close it, you just read. There is no way of reading by lines.

No IO.console.winsize. I'm currently stuck with the tput command. This means it doesn't work on windows.

No for loop, you must do with .each and intervals.

No global variables, You stick stuff into Modules.

What are private attributes useful for again? (OOP rant incomming)

If you want to use some array/hashmap of lambdas returning nil, they can't end with anything that could return a value. In these cases, end block with nil. I think this should be handled by compiler to be honest.

There is difference between string ("c") and char ('c'). This is not the case in ruby.

----------------------------

previous: to-the-crystal

next: TUI

b-logs

home

ctrl-c.club