7

... I remember thinking programming is amazing because everything is possible in it

in rust, nothing is possible

Comments
  • 2
    IF IT'S NOT OBJECT ORIENTATED WHAT IS IT
  • 4
    That's what makes it so memory safe.
  • 3
    That's why I'm fascinated w/ programming. Making a computer do what you want just feels awesome.
  • 2
    But then usually with rust, you realise that the thing you were trying to do that's been made impossible wasn't a good idea in the first place.
  • 1
    Yes but what you manage to do will never break
  • 2
    Yes but what you manage to do will never break
  • 2
    Think of it as granit. It's very hard to carve it but once you've done something it's undestructible.

    Now it only make sense to certain things, you wouldn't use stone for ustencils.

    Also I do love granit for pans. It doesn't attach, you can scratch it real good and it doesn't have chemicals.
  • 0
    Think of it as granit. It's very hard to carve it but once you've done something it's undestructible.

    Now it only make sense to certain things, you wouldn't use stone for ustencils.

    Also I do love granit for pans. It doesn't attach, you can scratch it real good and it doesn't have chemicals.
  • 4
    People don’t believe me when I say that js causes permanent brain damage. :]
  • 2
    @donkulator that’s exactly right! I had this realization going from C# to Swift.
  • 2
    Just don't use lifetimes and don't use mutexes

    Spawn "single threaded" tasks which communicate via channels. If you need shared data use immutable lists/maps from the`im` crate. I think that would fix like 90% of your issues with Rust

    Like I know you're doing mostly async and async can be challenging but from what I understand you mostly do web based stuff. It *really* shouldn't give you that many issues to write a http client with a bit of data processing
  • 1
    @12bitfloat js heads just slap async on everything because they don’t need to think about it that much. Errors are not caught at compile time and race conditions are shrugged off as "meh, not that big of a deal", if they are ever noticed in the first place.
  • 2
    while(jestdotty.isMentionRust) { self.interestInRust++;

    }

    It seems Rust would be hard for me as I still don't master Java itself, for example, and Rust would expect me to be able to handle low-level things.
  • 2
    Now, to try and answer your question - presumably you already know - Rust is (according to wiki):

    Concurrent, functional, generic, imperative, structured

    From AI:

    It seems it favors composition over inheritance for loose coupling and does not want to be pure OO because that can be brittle. Its imperative model makes for safer code because you have to precisely think about what you write and hidden costs aren't abstracted away (e.g. GC).

    Rust seems to be semi-functional, imperative, procedural, compositional and performant.
  • 0
    @donkulator yes programming is not a good idea in the first place stage now 😵‍💫
  • 0
    @Lensflare js is just so easy
  • 1
    @12bitfloat no this is screeps code. no async. it's just interacting with JavaScript which can have object structures rust cannot

    and I fail at even coordinating that

    I may have solved it. I tried a base-level SQL-like table but turns out that's not so clever. so I'm going back to rc refcells for some data structures. maybe it's just habit from JavaScript on my part idk

    I'm experimenting. forget actually getting anything done. and been taking lion's mane again so hopefully my brain will remember this and not get irrevocably overwhelmed and crash because I have brain damage and thinking issues compared to my former self which makes me tremendously sad because intellectual stuff was my prime hobby and other things don't even crack anywhere close to the pleasure I would get from that smh
  • 0
    @Lensflare I can't remember having a race condition in js. I'm sure I have but I think it was trivial to fix so it wasn't even memorable there
  • 1
    @CaptainRant java is just a bunch of memorization of various named things which are all possible in JavaScript without the strait jackets

    java was pretty easy though. really boring. just a lot of different ideas/concepts in the language so it's a bit like reading an encyclopedia and memorizing things

    the new Boston on YouTube was who taught me java. was a popular guy at the time

    java is often people's first language because of the encyclopedia nature of it which is a good choice for beginners. then you don't have to understand something really, just memorize it and if you see the patterns then it's transferable to other languages and you get an intuitive sense of languages without being ableist / excluding people who might not "get" that stuff. my degree ended up favouring java as a starter language
  • 0
    @CaptainRant idk what those words mean

    I think it's cuz of the ownership model currently that I struggle. the style you're supposed to code in is probably "ownership orientated programming" as opposed to object orientated

    js I guess was "prototype orientated programming" so you could style yourself crazy in that way. js is also functional friendly. but I find rust has more in-built functional ideas on its arrays for example but there's still some annoying caveats sometimes I run into, missing features and stuff, or I did when I first began using it and kept running into "we want to make this feature but it's not in yet" like 5 times a day -.- lol. I'm intuitive so that was gay. it was just for syntax I figured should be possible
  • 1
    @jestdotty that’s the problem. Js is the embodiment of failing silently. The code runs and you don’t ever notice if it does something incorrectly.
  • 1
    @jestdotty Yeah.. Java can get boring with its strait jackets. I remember the new Boston from my early programming days as well. :)

    Java was technically not my first.. My first was BASIC (fun! colorzzzzz. ok lol), then LOGO, then.. err.. Delphi, then Pascal, then Java.

    In college, however, they started out with C but I got credit transfers for that class so I missed it. I'll pick up on that sometime. They also touched COBOL.. yuck.

    Yes, it's about the patterns with Java.. although that limits you and you have to understand programming and concepts itself to go further.
  • 0
    @Lensflare you notice it does something incorrectly because the data is wrong. in js unit tests were actually useful
  • 1
    @jestdotty // explanationz, part 1

    // disclaimer if you already knew this stuff, I tend to over-explain

    Okay, I will briefly provide a definition for those words:

    Concurrent:

    - happening at the same time without negative side-effects, no race conditions, semi-parallel processing

    Functional:

    - functions-based (of course you know this one)

    Generic:

    - fit for most common purposes (web, desktop, networking, hardware,...)

    Imperative:

    - You state and exclusively decide how the instructions are to be written - kind of like assembly. You decide everything low-level (unlike the declarative SQL).
  • 1
    @jestdotty // explanationz, part 2

    example of imperative:

    allocate memory for x

    allocate memory for new function

    move pointer to new function

    assign function name to be drawSquare at address 0x000008c

    move pointer next cursor location

    assign value 0 to x

    assign value 100 to x1

    assign value 0 to y

    assign value 100 to y1

    reset cursor back to 0

    execute line function

    end function

    // got lazy, some steps may be missing but you get the point

    example of declarative (system decides, not you):

    INSERT INTO SQUARE(x,y,x1,y1) VALUES (0,0,100,100)

    // You are just saying you want a square with said coordinates, you are not telling every precise step

    (ffs I hate this type of programming in a way, lmao)
  • 1
    @jestdotty // final ranting

    Ahem, alright. Procedural, as far as I know is that it follows a top-down approach and packages code into procedures/functions/methods.

    Composition:

    Object A is made out of Object B, which in turn is independently pluggable into it - plug n play

    example: car composed of wheels and parts

    relationship: HAS-A

    Inheritance:

    Object A cannot exist without Object B or is not easily detachable

    example: Bird is Animal, or: Checking Account is Account

    relationship: IS-A

    I sound like my professor. lol.

    Back to you:

    Ownership, hm, yes, I read about it for Rust. Yes, I learned JS to be 'it acts like a duck but isn't a duck', or if we want it more funny: "JS tries to be Starbucks but is just a regular cup of coffee". I do like the prototype, pros and cons. Yes, relatable and frustrating.. the missing features. Time to polyfill? Heh. Heh.
  • 1
    @jestdotty Ah got it

    A table-like approach can actually be pretty good if you use the slotmap crate (e.g. one slotmap/"table" per entity), that's how I'm storing stuff in my compiler! I really don't like Rc<RefCell<>> at all. With slotmap(s) you can keep your ownership in one place and give it out via &mut instead of having to lock the refcell everywhere. Much cleaner in my opinion! (but of course also no silver bullet...)

    I understand your frustration with JS interop... it can definitely suck trying to map such a dynamic language to a super static one like Rust
  • 0
    @CaptainRant oh imperative is why it's so annoying I see

    I'm not used to that. so you're supposed to literally spell everything out after all then! I only started trying to do it that way recently... uehf so ugly

    ---

    yeah I remember composition. I was lazy and you worked so hard on account of my laziness lmao
  • 0
    @12bitfloat if things have to cross access from multiple "tables" it's a nightmare for my brain. I don't think in SQL. I think in rc refcell cuz higher level garbage collected languages do everything by reference like that
  • 1
    @jestdotty

    Yes, imperative, where missing code means not working the way you intended. You're only supposed to spell everything out in such imperative languages. ;p

    ---

    Gimme DevRant coins for it. jk. I am innately a hard worker.. for what I care about. And I of course have empathy. :)
  • 0
    @jestdotty yes in js the only tool to catch those bugs is unit tests but not everything can be tested.
    Race conditions in particular can’t really be tested because they aren’t reliably reproducible.
    Coding with js safely is a fucking pain in the butt.
  • 0
    @antigermanist Isn't granite slightly radioactive?
  • 0
    @donkulator not more than bananas I guess
  • 0
    @Lensflare run it a few times
Add Comment