Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    fn add(a: u8) -> u16 { 
            let u15 t: a+7 
    }
I admit it looks more wordy, but I think this is a good thing. It might be nice to allow it but issue a warning about widening types.

As for the others, I kinda disagree. Enums allow for some nice syntax with match. Compare:

    match error_option { 
         Ok(Some(a)) => {},
         Ok(None(a)) => {},
         Err=> {}
    }
with

    match error_option { 
         Error.Ok(Option.Some(a)) => {},
         Error.Ok(Option.None(a)) => {},
         Error.Err=> {}
    }
See? It would get tedious fast with match pattern.

I had never had problems with mut. The syntax is clear and unambiguous. It's fine as is really. I actually like knowing which pointers are mutable, by keyword instead of typing arcane stuff like @~ptr, @&ptr. Seeing how @ was a sigil for pointers this would make most people do a double somersault in fear of the GC pointer returning.

I like macros with ! It tells you magic happens here beware. Not having those you'd have serious problem understanding where errors are once macro expands :?

Ternary operator? Wth? You can just use if as a superio ternary (endless chaining) operator.

    let ter_demo = if a.is_none() then 3 else 2;


Your ternary demo needs to be written thus for it to work:

    let ter_demo = if a.is_none() { 3 } else { 2 };
You can also often use pattern matching:

    let ter_demo = match a { None => 3, _ => 2 };


Yeah, I wrote the example out of my head, so no surprises there. Thanks, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: