I understand it's the most common use case, but why not allow it in any part of a literal? Thanks, Evan
I can't imagine a good example for the alternative, and I think languages should encourage an idiomatic use. Ruby idiom, for example (the language I know best other than javascript), uses foo? to mean predicate/question and foo! to mean something like side-effecting or more-destructive. I can't imagine a situation in which it would be especially meaningful or readable to have multiple punctuation marks. Can you? –Jacob On Sun, Dec 12, 2010 at 7:00 PM, Evan R. Murphy <evanrmurphy@gmail.com> wrote: > I understand it's the most common use case, but why not allow it in > any part of a literal? > > Thanks, > Evan >
The idioms you mention are the ones I know the best too. (I think
they're the convention in Scheme as well as Ruby.) But I was hoping to
define a ternary operator `?:` that looks like JavaScript's:
; sibilant //javascript
(?: a b (a ? b
c d : (c ? d
e) : e))
Another case would be if you had multiple versions of an operator, you
might want to have `foo!` and `foo!2`.
Thanks,
Evan
On Sun, Dec 12, 2010 at 11:16 PM, Jacob Rothstein
<jacob.rothstein@gmail.com> wrote:
> I can't imagine a good example for the alternative, and I think
> languages should encourage an idiomatic use. Ruby idiom, for example
> (the language I know best other than javascript), uses foo? to mean
> predicate/question and foo! to mean something like side-effecting or
> more-destructive. I can't imagine a situation in which it would be
> especially meaningful or readable to have multiple punctuation marks.
> Can you?
>
> –Jacob
>
> On Sun, Dec 12, 2010 at 7:00 PM, Evan R. Murphy <evanrmurphy@gmail.com> wrote:
>> I understand it's the most common use case, but why not allow it in
>> any part of a literal?
>>
>> Thanks,
>> Evan
>>
>
Another idiom that uses special characters in the middle of a symbol (although different special characters than we've been talking about) is conversion operators like `string->number` or `array->hash`. Evan On Mon, Dec 13, 2010 at 12:41 AM, Evan R. Murphy <evanrmurphy@gmail.com>wrote: > The idioms you mention are the ones I know the best too. (I think > they're the convention in Scheme as well as Ruby.) But I was hoping to > define a ternary operator `?:` that looks like JavaScript's: > > ; sibilant //javascript > > (?: a b (a ? b > c d : (c ? d > e) : e)) > > Another case would be if you had multiple versions of an operator, you > might want to have `foo!` and `foo!2`. > > Thanks, > Evan > > On Sun, Dec 12, 2010 at 11:16 PM, Jacob Rothstein > <jacob.rothstein@gmail.com> wrote: > > I can't imagine a good example for the alternative, and I think > > languages should encourage an idiomatic use. Ruby idiom, for example > > (the language I know best other than javascript), uses foo? to mean > > predicate/question and foo! to mean something like side-effecting or > > more-destructive. I can't imagine a situation in which it would be > > especially meaningful or readable to have multiple punctuation marks. > > Can you? > > > > –Jacob > > > > On Sun, Dec 12, 2010 at 7:00 PM, Evan R. Murphy <evanrmurphy@gmail.com> > wrote: > >> I understand it's the most common use case, but why not allow it in > >> any part of a literal? > >> > >> Thanks, > >> Evan > >> > > >