8 ms·
It's somewhat higher level than C. I've always liked to think of myself as a programming polyglot, able to pick up and reason about nearly any standard languag
by byuu 12y ago
It's somewhat higher level than C.
I've always liked to think of myself as a programming polyglot, able to pick up and reason about nearly any standard language. I'm not sure how Rust is doing it, but the more I read and learn about it, the more confused I am. The syntax is just so bizarre and counter-intuitive to me. And yet I seem to be the only person in the world who doesn't "get" it. It's as if the language is being explicitly developed to be my kryptonite.
- lincolnq 12y agoRust seems to me much more like Haskell than C or C++. Try thinking about it that way and see if it makes more sense.
- byuu 12y agoInteresting, that could well be it. Languages I pick up very easily (in rough order): C, C++, PHP, C#, Java, Scala, Perl, Python, Ruby, Javascript, Lisp. Haskell is definitely one that gives me trouble as well. It's not the functional aspects: I've no trouble writing recursive descent parsers and the like in C++. I can't stand the parentheses, but I can understand and reason with Lisp. I think in Haskell's case, it's just doing too much with too little. Like how they can implement quicksort in three short lines of code, and to me it's just so much to unroll in my head at once; but it's hard to be sure for obvious reasons.
- Yxven 12y agoI've been using Haskell for a few months now, and quicksort has become trivial to read. Although, I agree that knowledge of other programming languages barely transfers to Haskell. I think being very different is the main factor that restrains Haskell's growth. It says a lot that Haskell's popularity grows anyway.
- panzi 12y agoAll the languages you list maybe except for Lisp are basically the same. They are all imperative, some of them are object orientated. If you understand e.g. C++, you should understand any of the others with not much effort. Really different languages would be Haskell, Prolog and maybe APL. Or recursive (hence Turing complete) SQL queries.
- codygman 12y agoThere's only one thing you need to learn Haskell: 1. Forget everything you know and follow the types. 2. https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell
- panzi 12y ago> The syntax is just so bizarre and counter-intuitive to me. Really? What part of the syntax in particular?
- byuu 12y agoPretty much all of it. For example, let's take http://chrismorgan.info/blog/teepee-design-header-representation.html http://chrismorgan.info/blog/teepee-design-header-representa... impl<'a> AnyRefExt<'a> for &'a Header { #[inline] fn as_ref<T: 'static>(self) -> Option<&'a T> { trait UncheckedAnyRefExt<'a> { unsafe fn as_ref_unchecked<T: 'static>(self) -> &'a T; } //I am guessing the second line is special because Rust can't deduce "to" should be a TraitObject type? let raw = require_single_field!(raw); let to: TraitObject = transmute_copy(&self); //is this adding header and 'static together? pub trait HeaderMarker<OutputType: Header + 'static> { //I have zero clue what this is doing //I can't even fathom a guess match *self { Past => write!(f.buf, "0"), ExpiresDate(ref tm) => tm.fmt_header(f), } //so _raw is a reference to a vector of bytes inside [] and it might possibly return whatever a box is of headers? fn parse_header(_raw: &[Vec<u8>]) -> Option<Box<Header>> { //is there really a language keyword called macro_rules! ? macro_rules! impl_header_from_fromstr { //what in the world is ($ty:ty)? ($ty:ty) => (impl Header for $ty { fn parse_header(raw: &[Vec<u8>]) -> Option<$ty> { //who thought "h.is::<H>()" was a good way to test a type? Why not "h.is(H)?" Why the => ? //what is this even returning? a tuple of false and None? Typed(ref h) if h.is::<H>() => { (false, None) }, //... why not UTF-8? Because "{}"? format_args!(format_but_not_utf8, "{}", HeaderShowAdapter(h)) The names don't make any sense to me at all. What the hell is an AnyRefExt? How does an UncheckedAnyRefExt differ? What in the world is the match thing doing? Why the asterisk on self? Why all the apostrophes and colons and dollar signs and exclamation points? Why is there both -> and =>? How does an &' differ from a '? I could probably learn the language with a huge time investment. But for something aiming to fill the role of systems programming, it's just so incredibly different from everything else. It almost feels like they are going out of their way to make it as different as possible. I know, this is all syntax stuff. C++ template meta-programming syntax is pretty insane, too, and took me a while to pick up. Yet when I attempt to read up on the syntax and the reasoning, it becomes even more confusing. I don't expect them to write a C++ clone, I understand this is their own language. But just a tiny modicum of reflection that people have spent 15+ years learning the syntaxes and behaviors of C-like languages would be so greatly appreciated. I mean, you see how Haskell is doing, and a lot of people blame that on the absolutely alien syntax to anything programmers are used to. Yet, with Rust, everyone else with C-family backgrounds just seem to look at this, and go, "oh yeah that makes sense." Boggles my mind.