New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:?smth should construct a truthy pair (say (:?foo)) #6405
Comments
From @AlexDanielThis should work: Code: Result: Because these work: Code: Result: |
From @zoffixznetOn Sat, 22 Jul 2017 07:53:26 -0700, alex.jakimenko@gmail.com wrote:
-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 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. |
The RT System itself - Status changed from 'new' to 'open' |
From @AlexDanielEh. 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, cpan@zoffix.com wrote:
|
From @AlexDanielsub foo($bar!) { say $bar }; foo(42) On 2017-07-22 11:19:41, alex.jakimenko@gmail.com wrote:
|
From @LLFournSorry for being think but what is On Sun, Jul 23, 2017 at 6:05 AM Aleks-Daniel Jakimenko-Aleksejev via RT <
|
From @AlexDanielYes, 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.fourn@gmail.com wrote:
|
From @LLFourn2¢: ‘:foo’ sets foo to True. ‘:!foo’ sets it to False. ‘:?foo’ looks like it's On Sun, Jul 23, 2017 at 12:41 PM Aleks-Daniel Jakimenko-Aleksejev via RT <
|
From @perlpilotThe OP said :?foo should work because :foo and :!foo work. I don't follow I don't see any benefit to adding a :?foo syntax that means exactly the So ... -1 for me too. -Scott On Sat, Jul 22, 2017 at 10:11 PM, Lloyd Fournier via RT <
|
From @AlexDanielI wouldn't be so eager to judge the proposal based on the original post. Sometimes I submit tickets fast, and sometimes ideas are not conveyed as clearly as I assumed. “How are those things related?” Check out irc logs for more discussion. On 2017-07-22 21:50:58, duff wrote:
|
From @AlexDanielFor those reading this on RT, here's the previous comment in a readable way: I wouldn't be so eager to judge the proposal based on the original post. “How are those things related?” Check out irc logs for more discussion. |
From @AlexDaniel“? doesn't imply truth it implies a question” This is an interesting point actually. pmurias++ expressed the same idea. I find it hard to understand this fully, but I guess I'll have to accept that there are different ways to think about it :) For example: And then we also have ?? !!, where again we have ? as kinda an opposite of !. I think no matter which way you think about it, the emerging pattern seems to be rather clear. And it does help to learn the language, at least it does help me. I mean, previously I said that we have only two precedents of ?↔!, but now looking at ?? !! I think it follows the same pattern. Note, however, that I am not saying that ? should be replaceable by ! anywhere, which the first answer here implied for some reason. I'm mainly just saying that there is pattern and the lack of :?foo syntax is an exception rather than a rule. From this many other benefits can be derived, if needed. I hope this clarifies it a bit. On 2017-07-22 20:11:35, lloyd.fourn@gmail.com wrote:
|
From @AlexDanielFor those who don't agree that there is a connection between ? and !… Actually, there are some other places where ?↔! connection is implied. In fact, I will probably never list all of them. In regexes: I would also do the job for the other side and provide some counter examples: This raises a question: well… should we implement these too? Maybe this: “If you’re gonna generalize, do it harder, but not too hard.”[^1] is relevant here, but maybe not. Bonus: Anyway, that's some good food for thought I think. [1] https://perl6advent.wordpress.com/2014/12/24/day-24-seeing-wrong-right/ |
From @AlexDanielAnother interesting thing is that if this is implemented, then it will make it possible to use ? in other places where <colonpair> is used. For example, it will allow %h<x>:?exists . It seems that it will also affect character classes (e.g. <:?Ll>). Some of these totally make sense, some not so much. But we already have :!delete and nobody seems to be complaining :) There's also <quotepair> which has very similar logic, it does support ! but does not support ? (e.g. m:!i/ … / but no m:?i/ … /). I wonder, if <colonpair> is ever touched, should the same thing be done with <quotepair> also? On 2017-07-22 23:40:53, alex.jakimenko@gmail.com wrote:
|
From @cokeOn Sat, 22 Jul 2017 09:12:31 -0700, cpan@zoffix.com wrote:
-1 from me as well, I agree with these first three points.
-- |
From @zoffixznetBased on the tally of the opinions, I'm rejecting this ticket: AlexDaniel: +1
I think that's pretty good evidence the extra syntax doesn't offer any additional clarity.
"!" ubiquitously means "not" in programming. If ":foo" is True, ":!foo" is "not True"
There `??` asks the question and the `!!` segment is the "not" portion of the answer.
That may have been a question 3 years ago, but I think after the stable language release it's a bit too late to make sweeping proposals that alter the entire syntax landscape. You yourself aren't even sure of all the bits that will be affected, much less of what unwanted interactions this new syntax will introduce. All design changes—especially ones this large—carry risk with them of designing yourself into a corner. Usually, there's pay off for the risk taken. However, this proposal offers none. Not only does it offer no extra functionality, it's not even a beneficial (more concise, easier to remember, etc.) alternative to existing syntax. The only pro argument is consistency, but based on the previous replies, it appears there's quite a lot of disagreement even on that.
Discussions like this is how we avoid making a mistake we'll have to pay for for the next decade or longer. It's not the first time you complain about discussions taking longer than implementation and I wish for once you'd realize that implementation time is insignificant; it's the support of the feature for the next decade that matters. |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#131781 (status was 'rejected')
Searchable as RT131781$
The text was updated successfully, but these errors were encountered: