[-] philm@programming.dev 3 points 1 year ago

Not him, but I much more like the type-system of rust (e.g. enums).

[-] philm@programming.dev 2 points 1 year ago

It really depends. Maybe developing something like a game will require (almost) no CLI.

But do a little bit more server stuff, dev-ops, and you can literally not even do the job without cli.

Though in general, CLI is often better for the task, it often can easily be automated (via scripts etc.), which seems to be relevant for a lot of tasks programmers do...

[-] philm@programming.dev 2 points 1 year ago

Is it good technically though? Or is it just really popular because it's so well maintained and extensible?

I think the main reason vscode is so popular is, because there aren't really good native alternatives (e.g. I wouldn't compare e.g. vim because it's kind of a different target audience).

So maybe something like zed or so will take the reign of this class of editors, but we'll see, I just hope it's not yet another electron or DOM based editor, DOM is bad enough in the web already...

[-] philm@programming.dev 2 points 1 year ago

Or in other words, you can already try it, it's open source: https://github.com/pop-os/cosmic-epoch

[-] philm@programming.dev 2 points 1 year ago

Yes agree, I need unsafe super rarely, and often it's just for small optimizations (like std::mem::transmute::(kind) where SyntaxKind is an enum with #[repr(u16)]).

But I guess it depends on what you're doing exactly though (the higher-level, the less unsafe you need).

[-] philm@programming.dev 2 points 1 year ago

For example, if I’m writing a compiler for a new toy language

Ok, thinking about it (since I wrote a toy language not so long ago), this is probably a perfect example where unit tests make sense almost everywhere (even for prototyping, say parser).

I think it definitely depends what you're doing, writing unit tests for prototype graphics (engine) code is no fun (and I see no real benefit).

Code readability counts, but I don’t think it’s enough.

I think it depends, For general architecture, E2E or integration tests definitely make sense, for finer-grained code, I think documentation (Rust doc) of the functions in question should be enough to understand what they do (including some examples how to use them, could be tests, often examples (similar as in std rust) in the rust doc are enough IMHO, and otherwise the code itself is the documentation (being able to read code fast is a valuable skill I guess). That obviously doesn't apply for everything (think about highly theoretical computer science or math code), but yeah it depends...

[-] philm@programming.dev 2 points 1 year ago

But how do you find a website and the relevant content then?

I agree, that you should have a good search on a platform, specifically optimized on the scope of that platform, but it's just an unfortunate truth, that google is often better than these individual searches.

SEO could also just mean that all the stuff is actually server side rendered, so that google is able to find the content (which is not the case yet for lemmy-ui, but there is lemmy-ui-leptos in development, which should support that at someday)

[-] philm@programming.dev 2 points 1 year ago

I have the feeling, that this age will come back in one way or the other (and I have the feeling Rust and Webassembly will be involved ;))

[-] philm@programming.dev 2 points 1 year ago

...If you need both, you use Rust

[-] philm@programming.dev 2 points 1 year ago

I firmly believe it’s the best tool for students to learn how a computer intuitively works.

Yeah C is certainly a language students should learn (in contrast to C++ IMHO). It's a dead simple language (well for what it is capable of at least, also to write a compiler for, which is a good academic task) that was very influential and is still here to stay for quite a while (not necessarily directly the language itself, but rather the ABI I think).

how that’s too different from TS

well it's really baked into the language, no intermediate transpiler or compiler is necessary, and the ecosystem should be a little bit nicer to use (as less bundling is necessary, which I kind of detest after having gone into that rabit hole a little bit too often and "wasted" quite some time with (configuring) it).

functional programming with TS out of curiosity?

It's not really issues, but I know that something like this:

array.filter(e => <condition>).map(e => <some mapping function>)

is concise and reading like how it should be done, but it's just less efficient than just looping over the array and doing all the things in place (because every time filter or map or reduce or all the functional niceties is used, a new array is allocated and you want to absolutely avoid allocations if possible). Javascript is a little bit dumb when it comes to allocations (in design itself, something like V8 can't really help here at least most of the time).

In Rust the same is often even more efficient than manually looping over, doing it in place it (probably because of aliasing guarantees). I saw a few interesting posts way back on reddit, that found this out, the (performance) equivalent imperative version was ugly to read. So the default way one would approach the problem in Rust is often also the most efficient, which is obviously very nice to have.

Or another thing I would like to use more often in Java/Typescript is factory functions, something like this:

function createMyObject(param1, param2) {
  // do something with param1 and param2
  // a few functions that could be seen as methods
  function myMethod() {
     param1 += 1 + param2;
  }
  return Object.freeze({
    myMethod,
    param1
  })
}

But also here, everytime createMyObject is run, all of the stuff/methods inside is allocated again (instead of creating/compiling function references), maybe this can/will be optimized at some time (probably with a transpiler/compiler again, yay -.-).

So in general: writing nice (to read) code in Typescript/Javascript often leads to a lot of allocations, and I detest that a language is designed in a way where you want to write nice looking code but you're punished for it with inefficiency.

[-] philm@programming.dev 2 points 1 year ago

The language itself certainly has a nice appeal, but I just don't like the JVM and inheritance styled OOP... it's personal... haha

[-] philm@programming.dev 2 points 1 year ago

Yeah I hope that will improve over time (maybe with the necessary ergonomic changes for async traits and higher kinded types). But I feel this is just a matter of time and will likely be much better after the next Rust edition

view more: ‹ prev next ›

philm

joined 1 year ago