3 ms·
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. Que
by Ciantic 3mo ago
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.
- JBits 3mo agoIs there any reason why they're not considering a single '?' like rust? Is it a parsing issue? So you'd have: obj?:method(…)
- orthoxerox 3mo agoMike 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.
- nmz 3mo agoa lone ? can mean anything, you can already tell that . is for fetching a subtable.
- orthoxerox 3mo agoIn C# it's not a lone ?, it's two operators: ?. and ?[ Lua could have ?. ?[ ?" ?{ and ?(
- nmz 3mo agoI'd rather it use ?.() the . means getkey, () means expression using .(expr) should be the same as array[], throwing ? as a character should be very obvious what it does.