@wycats this looks confusing, especially the chaining. It's not obvious that `.large` is related to `.thumbnails`, not `u`.
-
-
-
@nerdblogpl I find it easier to read than u.?profile.?thumbnails.?large, which reads like a mishmash to me & visually conflicts w/ ? methods -
@wycats unfortunately I agree. I'm still worried it'll lead to unintentional errors with more complex conditionals because it's non-obvious -
@nerdblogpl It would probably lead to parentheses in complicated situations, but that seems ok. -
@wycats (u && .avatar && .large) && (u && .avatar && .small) doesn't look so sexy anymore :) -
@nerdblogpl syntax error. -
@wycats this one should/could actually work like u.try(:avatar).try(:large) && u.try(:avatar).try(:small) -
@nerdblogpl oh I missed what you did there. The reason it's getting complex is that it's describing something that isn't a one-liner. - 3 more replies
New conversation -
-
-
@wycats JS needs to get a safe navigation operator as well... -
@tikotzky I want `??` as a version of `||` that only short-circuits null, undefined and false. A person can dream. -
@wycats as opposed to any falsy value? -
@tikotzky yeah, wouldn't include 0, empty string, or NaN -
@wycats ah ok, so a diff new operator. Though you were referring to somehow using it to do safe navigation -
@tikotzky If we had `??`, we could possibly do `u ?? .profile ?? .thumbnails ?? .large` -
@wycats a leading dot would be new syntax only valid after a '??' ? - 4 more replies
New conversation -
-
-
@wycats earlier in that thread is a link to a proposed &. syntax, which I would prefer for this, and also has other use-cases. -
@TheAmazingRando what I like about && is that it puns so well with existing idioms -
@wycats I agree, but this also follows nicely from the &:foo syntax: 'u && &.try(:profile) &.try(...)' -
@TheAmazingRando that's too many levels into obscure syntax for me ;) -
@wycats Fair enough. I find the `.?` to be pretty ugly, myself :)
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.