Better HN
topnewbestaskshowjobs
Log inSign up

staticassertion

13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions

@insanitybit
Submissions

comment 8y ago · link · parent

Think of all of the applications built in C++. There are many.

I expect rust to encroach on those quite a lot, as well as less system-y C code (such as utils).

It's still early days. Rust is showing a lot of promise, for me personally, when writing high performance web services.

comment 8y ago · link · parent

Almost certainly, yes.

And lots of big companies use Haskell, just like Rust - Facebook has used it for a while now.

It's important to remember that while rust may dominate the HN headlines, it's still a very niche language. That said, it's also showing a lot of promise in a world that largely dismisses programming languages as being irrelevant.

comment 8y ago · link · parent

Seems like good company to be in.

comment 8y ago · link · parent

I think you'll have a hard time finding conclusive research like this for any languages.

Many papers exist but often have conflicting results, or weird methodologies, or extreme artificiality. It's really expensive/ hard to generate good research on this topic that controls for the big variables - you basically need a company that's willing to throw away at on of developer time to build two versions of the same product in both languages, then a metric for measuring success, a way to ensure you take dev skill into account, etc.

So instead it seems a lot more worthwhile to not bother looking for objective research as it won't be found.

I think a better approach is to just use what we have - sense and anecdotes.

From a sensibility standpoint, let's take a step back from rust.

Do we expect fewer memory safety vulnerabilities in Java vs C? Probably yes - Java is a memory safe language with few escape hatches.

So what about Rust vs C? It's a bit less clear as rust has a more oft used escape hatch, but I think we can reason that it's likely to have fewer memory safety bugs.

Would we expect fewer bugs in general? That's much harder to discuss with that approach.

You can look at testaments from Servo devs, and other companies using Rust ( https://www.rust-lang.org/en-US/whitepapers.html ) and their experiences.

comment 8y ago · link · parent

I don't see how that's really relevant.

comment 8y ago · link · parent

To give a somewhat different reason than what I'm seeing, I don't care too much about the 'memory safety plus speed' thing. I'm often building services that would be "fast enough" in Java. Is it nice to be faster? Yes, definitely, and that's part of why I write Rust, but not the whole story by any means.

I like rust for a few reasons.

* I really like Rust developers - I've met many, talked with many, and we get along and they've helped me through many technical problems, both big and small.

* I found rust extremely easy to get started with. I knew I'd have to learn the language, I did not also want to learn build tooling, package management, etc. These barriers exist in many other languages, it's frustrating because I just want to focus on programming. Cargo is excellent and I am a huge fan of how rust manages crates.

* I find it very easy to express what I want in rust, to reason about the code, etc. I know when a function might error, I know when I need to handle some unforseen case, I can express how a variable is used, when it is usable, whether it can be mutated. I can cut down on boilerplate with generics and macros.

The last point is what keeps me coming back. I find rust extremely easy to write, because it makes the things I care about easy to express.

comment 8y ago · link · parent

Actually, I realized we don't even give local admin. I forgot. Unfortunately, no editing.

comment 8y ago · link · parent

As I said in my edit, this is all subject to the details of a company's posture.

comment 8y ago · link · parent

Of course, some people need admin capabilities. But a senior developer? Nah.

Engineers whose specific job it is to admin infra, yes.

Logging is great, but it's a 'we are owned, how do we get them out' measure - we want to avoid getting to that point.

edit: Of course, this all depends on your threat model, posture, maturity, etc. I'm just saying - we have lots of very good reasons to lock devs out.

comment 8y ago · link · parent

You know what developers do with root?

They install bitcoin miners.

They install malware.

They install all sorts of shit.

It's unfortunate but it's true, I've seen it 100x.

We let our devs have local admin at my company but please don't misunderstand the serious risks involved in that decision. We take great measures to ensure that we can do that while still keeping our customers safe.

We would never allow admin AWS access, that's absurd. An attacker on your box would be able to own prod. Sorry that it's an inconvenience! When you manage to solve infosec, hit your ops/sec team up, they'll be happy to hand you the keys after that point.

comment 8y ago · link · parent

I think my point stands even with a loose definition of 'never'.

comment 8y ago · link · parent

I do not see how censorship at the CA level is worse than the ISP/ DNS level. We should not discourage people from using TLS because it allows for one of many other methods to censor.

SEC takedowns have happened for years without relying on TLS.

comment 8y ago · link · parent

This is really silly to me.

Making computers accessible seems like a completely reasonable, sound priority. Yes, computer literacy is something we all need to work towards, but we'll never be in a world where the average person understands PKI, and saying that we should limit accessibility until they do is absurd.

comment 8y ago · link · parent

The people talking about ethics here are not necessarily people who would have no problem torturing and killing pigs for food.

comment 8y ago · link · parent

"the scientists concluded they were producing a flat brain wave comparable with someone in a comatose state."

comment 8y ago · link · parent

"People who don't agree that this is good are just dumb nerds, but UGH I'll get downvoted for this opinion"

comment 8y ago · link · parent

> What's your definition of what makes a language static verus dynamic?

Types are checked before program execution.

I think this definition is very, very standard, and in keeping with a type theory view.

> Being able to describe and annotate types doesn't make a static type system. A static type system is a way of associating with each valid program a proof that there will be no runtime type errors (or at least that certain entire classes of runtime errors will not occur).

These two statements seem to contradict each other. Adding the type annotations is exactly what allows mypy to associate a proof with code.

I don't think the definition is useless... it seems entirely consistent with gradual typing.

comment 8y ago · link · parent

I'm sure it's not new.

comment 8y ago · link · parent

I don't use this as much as copy/paste, but I absolutely use it daily.

comment 8y ago · link · parent

That sounds like considerably more work.

comment 8y ago · link · parent

It might be a plugin called String Manipulation.

comment 8y ago · link · parent

Increment duplicates is just one of many, many utilities that pairs well with multiple carets.

Formatting is another.

Boilerplate code, for example today I had to implemented code like this:

    impl Into<Node> for ProcessNode {
      fn into(self) -> Node {
        Node {some_boilerplate(self)}
      }
    }
I had 6 node types. Using multiple cursors I:

* Implemented it once

* Duplicated it 5x

* Copied the names of the types I needed to impl for

* Attached a cursor to each impl

* Used ctrl + left/ right to word-jump, and past in the appropriate area

Now it's not like this saved me more than a minute or two, but this sort of thing is extremely common in my experience, across languages.

comment 8y ago · link · parent

All of the languages I can think of rely on the compiler backend for loop unrolling, which means it isn't a guarantee. You might want this if you need to guarantee the unroll.

But I wasn't doing this for a loop unroll.

I had a fixed size array that I wanted to serialize/ deserialize to/ from capnproto - there are no fixed size arrays in capnproto, so I wrote a message that just had b1, b2, b3... b16, and then some code to pull it out into a statically sized array. It allowed me to pull a bunch of bytes into a much larger statically allocated array without any allocation or bounds checking.

comment 8y ago · link · parent

This exists in most editors I've used (intellij is alt + shift + click or double tap alt, if I recall). I don't know how people program without this feature - they should teach this shit in school.

Multicursor is amazing.

One thing it's been great for:

I have code like:

byte b1 = array[0];

And I want to do this for 16 bytes. Control + D to duplicate 15x. Double tap control, hit up 15 times - now there's a cursor at every row. Hold control, hit right (jump by word), index to end of 'b1' on each line. Ctrl + shift + a, 'increment duplicates' - now every line is 1, 2, 3, 4... 16. `ctrl + right` my way to the index key and do the same thing.

It's awesome.

edit: I just found 'duplicate and increment' :o

comment 8y ago · link · parent

I don't get where this whole "expressions vs values" thing is coming from. Why are you making this distinction? I don't get it. The expression '2 + 2' has a type in mypy - so why are we drawing this distinction here of all places?

> Yes, you can sometimes figure out what the type of an expression must be, but the ability to do so is incidental and not guaranteed by the language, nor an inherent part of its semantics.

It's not guaranteed with most languages - they build up from primitives, and almost all of them have some sort of soundness holes.

If I have every primitive type in Python correspond to a type in mypy, I don't get how that isn't a basis of a static type system.

It seems like you're talking about the difference between evaluation and a value itself. But mypy types are evaluated...

> The notion that dynamic languages are "unityped" comes from looking at them through the lens of static typing, leading to a disconnect about what "type" means and a correspondingly meaningless answer.

Pretty sure it's just the simple, type-theory way of defining it, and I don't see why we would define types in a way that isn't consistent with type theory.

1
150151152
164