From: "D. Deryl Downey" Date: 2013-04-03T06:07:48+09:00 Subject: [ruby-core:53904] Re: [ruby-trunk - Feature #8191] Short-hand syntax for duck-typing --f46d042f921011ddb704d96721e1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm sitting here lurking on this thread and to me the proposal makes everything seem convoluted. Though user??.website??.profile?? could feasibly be worked out by a new to intermediate user as asking progressively if user was present and if so was a website object associated with that user and if so was a profile associated to the associated website present. But the syntax of that semantic isn't really clear or 'natural'. Its starting to feel like things are moving towards being overly terse rather than clarity being a retainable goal. On Apr 2, 2013 4:57 PM, "Matthew Kerwin" wrote: > On Apr 3, 2013 12:03 AM, "rosenfeld (Rodrigo Rosenfeld Rosas)" < > rr.rosas@gmail.com> wrote: > > > > I believe you didn't understand the proposal, Matthew. a??.b would mean > (a.nil? ? nil : a.b). So user.profile??.website??.thumbnail is equivalent > to: > > > > user.profile.nil? ? nil : (user.profile.website.nil? ? nil : > user.profile.website.thumbnail) > > You are correct, I thought a.b?? meant (a.respond_to? :b ? a.b : nil) > since I thought I saw earlier something like `foo.empty???=C2=B4 > > In that case the missing question marks were earlier in the sequence: > > if user??.profile??.website??.thumbnail > --f46d042f921011ddb704d96721e1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I'm sitting here lurking on this thread and to me the proposal makes= everything seem convoluted. Though user??.website??.profile?? could feasib= ly be worked out by a new to intermediate user as asking progressively if u= ser was present and if so was a website object associated with that user an= d if so was a profile associated to the associated website present. But the= syntax of that semantic isn't really clear or 'natural'. Its s= tarting to feel like things are moving towards being overly terse rather th= an clarity being a retainable goal.

On Apr 2, 2013 4:57 PM, "Matthew Kerwin&quo= t; <matthew@kerwin.net.au&g= t; wrote:

On Apr 3, 2013 12:03 AM, "rosenfeld (Rodrigo Rosenfeld Rosas)"= <rr.rosas@gmail= .com> wrote:
>
> I believe you didn't understand the proposal, Matthew. a??.b would= mean (a.nil? ? nil : a.b). So user.profile??.website??.thumbnail is equiva= lent to:
>
> user.profile.nil? ? nil : (user.profile.website.nil? ? nil : user.prof= ile.website.thumbnail)

You are correct, I thought a.b?? meant (a.respond_to? :b ? a.b : nil) si= nce I thought I saw earlier something like `foo.empty???=C2=B4

In that case the missing question marks were earlier in the sequence:

=C2=A0=C2=A0=C2=A0 if user??.profile??.website??.thumbnail

--f46d042f921011ddb704d96721e1--