Live data from Hacker News

Dave Herman’s contributions to Rust

brson.github.io

21–30 of 174 posts

Re: Dave Herman’s contributions to Rust

#21
post #9

Earlier quoted context omitted.

Kotlin's version is even better: val & var Super clear. The "let" version smells a lot of "I have a CompSci PhD".

Practically, I prefer let and var because of autocompletion. Type one letter then tab. Of course, if I could dictate I might prefer something else. I think of it as being more math like rather than PhD. Nothing wrong with borrowing from math.

A good IDE will let you type "mu", and autocomplete with "let mu", cycling on tab will give you more options.

Re: Dave Herman’s contributions to Rust

#22
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

A relevant period of history here is the mutpocalypse, where the question was raised “why are we calling this &mut and teaching it as being about mutability when what we actually care about (for memory safety) is uniqueness and aliasing?” Had that side prevailed, &mut would have been renamed (the main candidates presented were &uniq and &only), and all bindings would have become mutable (`let mut` would have disappeared), because that concept wouldn’t make a great deal of sense any more. These are the only technical changes that it would have entailed (the biggest change would have been in pedagogy).

In the end, social factors and inertia trumped technical precision and consistency. I am strongly inclined to think this was a mistake. Mutability is easier to explain initially, but teaches an incorrect mental model that hinders a correct understanding of Rust’s approach to memory safety, falling apart as soon as you touch things like atomics, RefCell or Mutex, which mutate self despite taking it as &self, a supposedly immutable reference.

Re: Dave Herman’s contributions to Rust

#23
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

Kotlin's version is even better: val & var Super clear. The "let" version smells a lot of "I have a CompSci PhD".

It's interesting if "let" nowadays has mostly 'academic' connotations.

30 years ago I think it would have reminded people more of BASIC or Fortran than (say) Scheme.

Re: Dave Herman’s contributions to Rust

#24
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

It's bastardized OCaml. Instead of OCaml's mutable they inexplicably chose mut, which is ugly (same as pub).

But everyone is cheering them on.

Re: Dave Herman’s contributions to Rust

#25
post #15

The same story [0] was posted several hours ago by the author I suppose. [0]: https://news.ycombinator.com/item?id=27016848

Yep, this needs a `dup` mark somewhere. Edit for down-voters: the typical HN behaviour. Don't be lazy and take a time to explain why you downvote.

https://news.ycombinator.com/newsfaq.html

> Are reposts ok?

> If a story has not had significant attention in the last year or so, a small number of reposts is ok. Otherwise we bury reposts as duplicates.

> Please don't delete and repost the same story. Deletion is for things that shouldn't have been submitted in the first place.

Dupes are not against the rules. You're likely getting downvoted by people aware of that.

Re: Dave Herman’s contributions to Rust

#26
post #24
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

It's bastardized OCaml. Instead of OCaml's mutable they inexplicably chose mut , which is ugly (same as pub ). But everyone is cheering them on.

I think their reasoning for things that are shortened is that if it's something you will be writing a lot, it's nicer to have it shortened. So pub fn mut etc. are shortened, but return isn't

Re: Dave Herman’s contributions to Rust

#27
post #16
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

In Rust the `mut` does not apply to the `let`, but to the variable binding. So you can do this: let (x, mut y) = (5, 10); After this statement `x` will not be mutable, but `y` will be. You cannot do let mut (x, y) = (5, 10); So the way Rust currently works just doesn't map clearly on `let` and `var`.

This is true, but the decision was made far back enough that other design decisions would have been weighed with consistency with the short behaviour in mind had that been the option chosen, and Rust would work slightly differently than how it currently works.

This is in the era of a new version having patch notes like (paraphrased) "Of the four pointer types with special syntax, we've converted two of them to regular types with names and deleted the fourth" - it predated that much concern with backwards compatibility.

Re: Dave Herman’s contributions to Rust

#28
post #23

Earlier quoted context omitted.

Kotlin's version is even better: val & var Super clear. The "let" version smells a lot of "I have a CompSci PhD".

It's interesting if "let" nowadays has mostly 'academic' connotations. 30 years ago I think it would have reminded people more of BASIC or Fortran than (say) Scheme.

I think this would have been more true 10 years ago when Haskell and Lisp were the most likely place for people to have encountered "let".

Now? It's in Javascript in its ES6 evolution and related languages, Swift, Rust, and probably other "newer" languages I'm not aware of. Scala had it ten years ago also, but is more mainstream than it was then.

Re: Dave Herman’s contributions to Rust

#29
post #4

Haven’t learned Rust yet. I see they debated this: let and let mut let and var And went with the verbose option. Swift went with the succinct option, which I love about the language. In practice I suppose I do mostly type “let” in Swift so it doesn’t matter much Swift, however, chose ‘func’ instead of ‘fn’, after much debate. Those little things that are debated initially, then forever

A relevant period of history here is the mutpocalypse , where the question was raised “why are we calling this &mut and teaching it as being about mutability when what we actually care about (for memory safety) is uniqueness and aliasing?” Had that side prevailed, &mut would have been renamed (the main candidates presented were &uniq and &only), and all bindings would have become mutable (`let mut` would have disappe…

> Mutability is easier to explain initially, but teaches an incorrect mental model that hinders a correct understanding of Rust’s approach to memory safety, falling apart as soon as you touch things like atomics, RefCell or Mutex.

Could you elaborate or link to some material / discussion regarding that? I'd be very interested in how the alternative approach you're describing would change (or make unnecessary) constructs like RefCell.

Re: Dave Herman’s contributions to Rust

#30
post #18

Earlier quoted context omitted.

How is it not clear that var is variable?

Yes. I think the problem may be with the other one. "val" (and "let") don't seem obviously constant to me.

Yes, whenever I get confused I recall that var is obviously variable so therefore the other one must be val.
Post reply on HN