Yeah, I feel kind of torn on this on.

On the one hand, I've kind of grown used to the `is...` method naming
convention and it has nice discoverability properties (tab-completion) and
isn't generally too awkward (though double s's are sometimes weird
`issubset` `issubtype`, and it took me a while to figure out isa() => is a).

The syntax-hungry beast in me though loves the handiness of adding a `?` to
boolean methods. At this point, it's probably not worth the change, and my
main concern would be combining it with the ternary operator:

    result = good?(x) ? good : bad

The double `?` would probably get real old real fast.

-Jacob


On Thu, Jun 12, 2014 at 3:04 PM, Mike Innes <mike.j.in...@gmail.com> wrote:

> Indeed, Ruby has the ternary operator as well.
>
> I imagine it's unlikely to change at this point, but +1 for trailing ?
> from me – just in case :)
>
>
> On Thursday, 12 June 2014 19:30:58 UTC+1, Stefan Karpinski wrote:
>
>> It's definitely a surmountable thing – I'd actually be rather in favor of
>> using a trailing ? instead of the is prefix for predicates. I believe Jeff
>> prefers the is prefix.
>>
>>
>> On Thu, Jun 12, 2014 at 1:53 PM, Jameson Nash <vtj...@gmail.com> wrote:
>>
>>>  Interestingly (to me) Apples new language, Swift, uses ? as both a
>>> ternary operator and a suffix for 'nullable' values, so this isn't an
>>> insurmountable obstacle.
>>>
>>>
>>> On Thursday, June 12, 2014, Steven G. Johnson <steve...@gmail.com>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Thursday, June 12, 2014 1:08:37 PM UTC-4, Aerlinger wrote:
>>>>>
>>>>> Ruby has a useful convention where methods can end in a '?' to
>>>>> indicate that it returns a boolean value. This capability would be useful
>>>>> in Julia as well. Much like the bang (!) suffix on functions it might look
>>>>> something like this:
>>>>>
>>>>> function isEven?(n::Int)
>>>>>   n % 2 == 2
>>>>> end
>>>>>
>>>>
>>>> Yes, both the ! and ? suffixes are common conventions, possibly
>>>> originating in Scheme.  Note that if you have a ? suffix, then you don't
>>>> need the "is" prefix.
>>>>
>>>> However, ? is already being used for the ternary operator in Julia and
>>>> hence is not available for use in identifiers.  Hence we instead adopt the
>>>> "is" prefix convention.
>>>>
>>>
>>

Reply via email to