Hacker News new | past | comments | ask | show | jobs | submit login

No offence, but I hope you never can, because if you can, others can, and since Rust already uses '?' for something else, it's likely to just get confusing. Is the if syntax for ternary really that bad?



It's in different context. Reusing a keyword or an operator in different context happens all the time in languages.


Is it that different? Assuming you would use '?' and ':', presumable we might see both the following then:

    let foo = foo()?;
    let bar = bar() ? this() : that();


? already has different forms as of now. You can do foo()?; or foo()?.bar(). People don't seem to be confused.

expr ? expr : expr is just another form. The ternary form is so well known that I doubt people have problem recognizing it.


The usage of ? in foo()?.bar() is no different from its usage in foo()?; ...


Are those really 2 different forms? I was under the impression that these were the same:

    foo()?.bar()
    (foo()?).bar()




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

Search: