FizzyOrange

joined 1 year ago
[–] FizzyOrange@programming.dev 10 points 14 hours ago

Go to bed, you're drunk.

[–] FizzyOrange@programming.dev 2 points 14 hours ago

They're comparing it to Ada so maybe it's arguable. I'm not too familiar with Ada but I think it does have some type features that Rust doesn't. Though the example they gave (newtypes) is fairly easy in Rust too, and I'm sure Rust has type features Ada doesn't too.

I've never done it but apparently you can actually gradually transition to Typescript one file at a time by renaming them from .js to .ts. Might help a bit. Good luck anyway!

[–] FizzyOrange@programming.dev 55 points 1 day ago (1 children)

Actual blog post.

Great accomplishment. I think we all knew it must happen like this but it's great to see real world results.

I think this is probably actually the most useful part of the post:

Increasing productivity: Safe Coding improves code correctness and developer productivity by shifting bug finding further left, before the code is even checked in. We see this shift showing up in important metrics such as rollback rates (emergency code revert due to an unanticipated bug). The Android team has observed that the rollback rate of Rust changes is less than half that of C++.

I think anyone writing Rust knows this but it's quite hard to convince non-Rust developers that you will write fewer bugs in general (not just memory safety bugs) with Rust than with C++. It's great to have a solid number to point to.

[–] FizzyOrange@programming.dev 1 points 1 day ago (2 children)

Yeah IntelliJ does amazingly without type annotations but even it can't do everything. E.g. if you're using libraries without type annotations, or if you don't call functions with every possible type (is your testing that good? No.)

Static types have other benefits anyway so you should use them even if everyone in your team uses IntelliJ.

[–] FizzyOrange@programming.dev 1 points 2 days ago

In common usage a linter detects code that is legal but likely a mistake, or code that doesn't follow best practice.

Although static type checkers do fit in that definition, that definition is overly broad and they would not be called a "linter".

Here is how static type checkers describe themselves:

Pyright is a full-featured, standards-based static type checker for Python.

Mypy is a static type checker for Python.

TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.

Sorbet is a fast, powerful type checker designed for Ruby.

Here is how linters describe themselves:

Pylint is a static code analyser for Python 2 or 3. ... Pylint analyses your code without actually running it. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored.

(Ok I guess it's a bit redundant for Pylint to say it is a linter.)

Eslint: The pluggable linting utility for JavaScript and JSX

Clippy: A collection of lints to catch common mistakes and improve your Rust code.

Ruff: An extremely fast Python linter and code formatter, written in Rust.

You get the idea... Linters are heuristic and advisory. Quite different to static type checking.

[–] FizzyOrange@programming.dev 2 points 2 days ago

Honestly I would take a look through a good standard library that provides a lot of algorithms (e.g. C++ or Rust). That has the basics, especially for data structures.

Also have a go at some hacker rank tests. Especially if you want to learn dynamic programming (abysmal name), they absolutely love that.

[–] FizzyOrange@programming.dev 1 points 2 days ago (2 children)

Linters 100% won't. A static type checker is not a linter.

[–] FizzyOrange@programming.dev 5 points 2 days ago (4 children)

Yes because you used static type annotations. This thread was about code that doesn't use static types (or static type annotations/hints).

[–] FizzyOrange@programming.dev 3 points 3 days ago

It's an example to demonstrate that linters cannot reliably detect variable name typos - you need static types. None of the stuff you mentioned is relevant.

The typo in your example is also undetectable by linters. I think you're missing the point.

[–] FizzyOrange@programming.dev 3 points 3 days ago (3 children)

What's awful about this example? The only thing I do is access an object member. Does your code not do that??

[–] FizzyOrange@programming.dev 6 points 3 days ago

Yes you can use static type hinting and the static type checker (Mypy or Pyright) will catch that. Linters (Pylint) won't.

 

Does anyone know of a website that will show you a graph of open/closed issues and PRs for a GitHub repo? This seems like such an obvious basic feature but GitHub only has a useless "insights" page which doesn't really show you anything.

 

Very impressive IDE integration for Dart macros. Something to aspire to.

view more: next ›