← Back to context

Comment by yxhuvud

12 hours ago

In aggregate this looks like a godsend, but there are some examples (like foo?.:method) that looks atrocious.

Yeah, "?." as safe navigation operator even in JS where it already exists is eye-sore. They could use some other single character instead of two characters. Question mark is already doing a lot with ternaries etc.

Instead of obj?.:method?.(…) it would be like obj#:method#(…)

Replace # with your favorite extra character instead of questionmark.

  • Is there any reason why they're not considering a single '?' like rust? Is it a parsing issue?

    So you'd have: obj?:method(…)

    • Mike Pall wrote in the issue that it's easier to parse. If they get rid of the ternary operator, I'll ask him again to drop the period.