2¢:
? doesn't imply truth it implies a question. The ? prefix asks an
expression whether it's True or False. When used as a sigil like $?FILE
it's asking the compiler about something.

‘:foo’ sets foo to True. ‘:!foo’ sets it to False. ‘:?foo’ looks like it's
trying to ask something a question, but I'm not sure about what.

On Sun, Jul 23, 2017 at 12:41 PM Aleks-Daniel Jakimenko-Aleksejev via RT <
perl6-bugs-follo...@perl.org> wrote:

> Yes, I should have been more clear.
>
> Basically, it should work like (:foo) does, which is construct foo => True
> pair.
>
> On 2017-07-22 19:25:19, lloyd.fo...@gmail.com wrote:
> > Sorry for being think but what is
> > say (:?foo);
> > meant to do? The OP just says it should "work".
> >
> > On Sun, Jul 23, 2017 at 6:05 AM Aleks-Daniel Jakimenko-Aleksejev via
> > RT <
> > perl6-bugs-follo...@perl.org> wrote:
> >
> > > sub foo($bar!) { say $bar }; foo(42)
> > >
> > > On 2017-07-22 11:19:41, alex.jakime...@gmail.com wrote:
> > > > Eh. The effort required to implement the feature is much less than
> > > > having
> > > > discussions *like this*. I'll try to be quick.
> > > >
> > > > “there's large possibility of introducing some unwanted ambiguity
> > > > somewhere”
> > > >
> > > > A good thing to keep in mind indeed.
> > > >
> > > > I don't really like these discussions before actual PRs, but if we
> > > > think about
> > > > it a little bit…
> > > >
> > > > <colonpair> panics if it finds :! but then fails to find
> > > > <identifier>
> > > > (
> > > >
> > >
> > >
>
> https://github.com/rakudo/rakudo/blob/fb7ecb60f006b5738bfe7a234535e07344268b31/src/Perl6/Grammar.nqp#L1892
> > > > ), so if there is any ambiguity introduced, then it's not bigger
> > > > than
> > > > what we
> > > > have with :! already.
> > > >
> > > > I've tried ::!CLASS and it complains about private method !CLASS.
> > > >
> > > > :?foo itself says “Confused … expecting any of: colon pair”, so it
> > > > expects a
> > > > colon pair anyway.
> > > >
> > > > Maybe you have some good examples, but *so far* looks ok.
> > > >
> > > >
> > > > “complex syntax feature”
> > > >
> > > > Let's make this complex feature strangely consistent.
> > > >
> > > >
> > > > “OP came up[^1] with this idea while trying to think of more cases
> > > > to
> > > > add to
> > > > the catalog of colon uses in Rakudo”
> > > >
> > > > Why does this sound so bad? :) Does it really matter at what point
> > > > I
> > > > noticed
> > > > that the feature that I always thought was implemented actually
> > > > isn't?
> > > > I don't
> > > > use colonpairs as often, truthy or falsy, so never noticed before.
> > > >
> > > > However, even the fact that :!foo does not align vertically with
> > > > :bar
> > > > is enough
> > > > to convince me regarding the usefulness of the proposed feature.
> > > >
> > > >
> > > > “But if we follow that logic, it'd mean:”
> > > >
> > > > What I meant was that we can make it strangely consistent in a
> > > > useful
> > > > way. Then
> > > > you extrapolated it to unbelievable extents.
> > > >
> > > > Then there are examples that are totally unrelated to the ticket.
> > > > Even
> > > > ?? !! is
> > > > not in any way strangely consistent (you can't write else { } if {
> > > > }).
> > > >
> > > >
> > > > I like this definition a lot:
> > > >
> > > > <masak> "strangely consistent" is all about using loose connections
> > > > people have
> > > > in their brains, so that a feature feels syntactically vaguely
> > > > right
> > > > for
> > > > various reasons.
> > > >
> > > >
> > > > This ticket is not about making colonpairs accept prefix operators.
> > > > It
> > > > is also
> > > > not about being able to syntactically put ? anywhere you can put !.
> > > > And let's
> > > > also not bring unrelated stuff here (like colonpairs only accepting
> > > > natural
> > > > numbers with *no sign* whatsoever). What kind of derailing kung fu
> > > > is
> > > > this
> > > > anyway?
> > > >
> > > >
> > > > On 2017-07-22 09:12:31, c...@zoffix.com wrote:
> > > > > On Sat, 22 Jul 2017 07:53:26 -0700, alex.jakime...@gmail.com
> > > > > wrote:
> > > > > > This should work:
> > > > > >
> > > > > > Code:
> > > > > > say (:?foo);
> > > > > >
> > > > > > Result:
> > > > > > ===SORRY!=== Error while compiling -e
> > > > > > Bogus statement
> > > > > > at -e:1
> > > > > > ------> say (:⏏?foo);
> > > > > > expecting any of:
> > > > > > colon pair
> > > > > >
> > > > > >
> > > > > > Because these work:
> > > > > >
> > > > > > Code:
> > > > > > say (:foo);
> > > > > > say (:!foo);
> > > > > >
> > > > > > Result:
> > > > > > foo => True
> > > > > > foo => False
> > > > >
> > > > >
> > > > > -1 from me:
> > > > >
> > > > > 1) Colonpairs are ubiquitous in the language, so there's large
> > > > > possibility of introducing some unwanted ambiguity somewhere and
> > > > > it's
> > > > > hard to predict where it might occur
> > > > > 2) Colonpairs are already one of the most complex syntax feature
> > > > > of
> > > > > the language, requiring beginners to learn a wealth of syntax to
> > > > > understand most of the common code.
> > > > > 3) Given (1) and (2), I'd expect any changes to extend their
> > > > > syntax
> > > > > to
> > > > > carry large benefits, however, the proposal offers literally zero
> > > > > practical use and the OP came up[^1] with this idea while trying
> > > > > to
> > > > > think of more cases to add to the catalog of colon uses in
> > > > > Rakudo.
> > > > > The
> > > > > `?` prefix op at least coerces the already-true arg to Bool (e.g.
> > > > > `?"foo" === True`) but in the case of the colonpair, there's
> > > > > nothing
> > > > > to coerce, so there's absolutely no point in typing the extra `?`
> > > > > and
> > > > > it's unlikely anyone would want to type it.
> > > > > 4) The OP makes the case that this syntax should exist solely for
> > > > > the
> > > > > sake of consistency, by interpreting the `!` in `:!foo` syntax to
> > > > > mean
> > > > > the `!` op, and there exists the `?` op. But if we follow that
> > > > > logic,
> > > > > it'd mean:
> > > > > *) `!! ??` should be allowed too, to mean reverse ternary
> > > > > *) `::!CLASS` should mean `anything but ::?CLASS`
> > > > > *) `has $?foo` should be an alternative to `has $!foo`
> > > > > *) `self?foo` should be an alternative to `self!foo`
> > > > > *) `:-42foo` should parse just as `:42foo` parses
> > > > > The point being that the current syntax is `":"` vs `":!"` not
> > > > > `":"`
> > > > > vs `":" + some op`. And things that have "!" in them do not
> > > > > necessarily need to have a "?" alternative.
> > > > >
> > > > > In summation, there's no practical use of this feature and it is
> > > > > unlikely it'll ever be used in real programs. The colonpair
> > > > > syntax is
> > > > > used across the entire language and any changes to it have large
> > > > > impact. It's very hard to anticipate any problematic ambiguity
> > > > > cases
> > > > > introduction of `?` into colon syntax might have. And given lack
> > > > > of
> > > > > technical benefits of this feature, I do not think we should
> > > > > accept
> > > > > the risks.
> > > > >
> > > > >
> > > > > [1] https://irclog.perlgeek.de/perl6/2017-07-22#i_14907647
> > >
>

Reply via email to