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

> So you have something that has a ' in front, is that a lifetime, or a missing ' later?

Not once has this come up for me. They are in completely different places syntactically and can never overlap.

Sure, `'` might be text related in a lot of languages but definitely not universally. In LISP 'foo is shorthand for (quote foo) and also does not have a second character. Ocaml uses 'foo for types and foo' is just a valid identifier. Standard ML also has 'foo for type variables and I believe also allows identifiers named foo'. Haskell allows identifiers named foo' as well.

Maybe it's odd coming from languages you are familiar with, but it's not at all something that is unique to Rust.

> Rust does this with ! as well if I understand correctly

I am not sure how the case with ! is similar. Macros just end with ! to make them clearer visually, it's not part of an operator. There can never be any syntax ambiguity with them, neither visually or lexically. Also what would be the point. Take this example:

    try!(do_something(...)).further();
Do you really think this would be more readable?

    (macro try(do_something(...))).further();


> Do you really think this would be more readable?

Much more readable, I can just browse the code, and see: Hey a macro.

I mostly write Python, but sometimes have to read, debug and modify C, Java, PHP, JavaScript, Bash and so on. Having code being easily readable and obvious is a huge win.

Very often your code has to be read, and reasonably understood by someone who doesn't exactly know the language, or at least is much less proficient. They don't need to be able to do complex task or debug the inner most workings of your code, but they do need to be able to reason about it, quickly, if you want them to contribute with patches or detailed bug reports.




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

Search: