« first day (2021 days earlier)      last day (2930 days later) » 

7:02 PM
@NikiC @bwoebi What do you think about turning functions with Generator return type declarations into generators, even if they don't contain any yield? It would essentially be an empty generator. I think we can already do that with if (false) yield; currently.
 
What do you need an empty generator for? Why not return new EmptyIterator()?
Is there something about Generator's API that you need that Iterator doesn't have?
 
@LeviMorrison Coroutines in Amp with some implementations not needing async awaiting.
 
To clarify, those have to be Generators; they can't be Iterators?
 
Yes.
Iterator doesn't have send and throw.
Related: github.com/Room-11/Jeeves/pull/44/… /cc @DaveRandom
 
@JoeWatkins Question for you:
type:
        T_ARRAY     { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
    |   T_CALLABLE  { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
    |   name        { $$ = $1; }
;
I need to optionally have '?' in front of each of those.
Would you keep that rule and make a new one that does '?' type or change the rule to something like:
 
7:07 PM
I would like to chat to someone who is familiar with Zend Framework 2
 
type:
        T_ARRAY     { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
    |   T_CALLABLE  { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
    |   name        { $$ = $1; }
    |   '?' T_ARRAY     { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); $$->attr |= ZEND_TYPE_NULLABLE ; }
    |   '?' T_CALLABLE  { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); $$->attr |= ZEND_TYPE_NULLABLE; }
    |   '?' name        { $$ = $2; $$->attr |= ZEND_TYPE_NULLABLE;}
;
I think I'd prefer the former.
 
@LeviMorrison former
@kelunik Problem is that Generator is a legit return type for a function that is not itself a generator (but rather returns one created somewhere else)
 
@kelunik I've run into this problem as well. I just stick a yield after the return and make a note about being unreachable, but needed to make the function a coroutine.
 
You can also yield from []; :)
 
7:32 PM
Oh, nice @DaveRandom … a perfectly valid use case for traits \o/ github.com/Room-11/Jeeves/pull/44/files
 
!!version
 
@LeviMorrison the former looks better
@Levi How exactly did you plan to proceed?
 
did you delete those messages @Levi ?
 
@kelunik what Nikita said.
 
7:36 PM
wasn't ignoring you, was out ...
strange stuff is going on with chat ...
they are back now :s
 
@NikiC that makes Annotations/Attributes sound even scarier
@JoeWatkins if in doubt, just refresh the chat window
@NikiC under which circumstances, in master, can $this be null?
 
can't you have an optional_nullability rule ?
 
@JoeWatkins I think that's what he means with keep that rule and make a new one that does '?' type
 
@bwoebi Foo::instanceMethod()
We allow that still
 
@NikiC we still allow static calling of non-static methods from static contexts?!
 
7:41 PM
yah
It's deprecated
 
ah, I thought it were removed
 
I was playing with the thought of RFCing to forbid this for the case where the non-static method actually uses $this
In which case you'll get an exception on first use of $this anyway
 
Wes
!!rebecca
 
@Wes Happy Prebeccaday!
 
@NikiC when did we deprecate it?
 
7:42 PM
%type <num> optional_nullability

optional_nullability:
		/* empty */ { $$ = 0; }
	|	'?'			{ $$ = ZEND_TYPE_NULLABLE; }
;

type:
        optional_nullability T_ARRAY     { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); $$->attr = $1; }
    |   optional_nullability T_CALLABLE  { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); $$->attr = $1; }
    |   optional_nullability name        { $$ = $1; $$->attr = $2; }
;
 
There is only one case where I can see this making trouble, namely people like @Wes checking for isset($this)
 
Wes
@Jeeves no countdown? :B evenings
 
@JoeWatkins nah
 
lemme finish ...
 
don't do that
 
7:42 PM
I'd probably try something like that first, and then it would have conflicts and I would ask bob to fix it :)
why's that ? because conflicts or something else ?
 
Did anybody see room11 regulars releases by feeds in here recently? Not sure if impatient or broken
 
I think I have seen it pretty recently ...
 
k tnx
 
%type <ast> nullable_type

nullable_type:
		type { $$ = $1; }
	|	'?' type { $$ = $2; $$->attr |= ZEND_TYPE_NULLABLE; }
;

type:
       T_ARRAY     { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
    |  T_CALLABLE  { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
    |  name        { $$ = $1; }
;
 
Wes
@NikiC eat a dick :P i don't use static
 
7:44 PM
@JoeWatkins ^ that's the way to go
 
ah yeah, that's nicer
 
/* empty */ is always just inviting for future shift/reduce conflicts
 
@Wes :P I figured someone who wants to check if a return value is used also wants to check if a method was called statically or not :P
 
bad habits ...
 
@JoeWatkins Think that thing is called epsilon-elimination … you should do that more often :-)
 
7:46 PM
@bwoebi fully in 7.0
bob using fancy words again
 
@NikiC oh, only that recently … no chance to remove in 7.1 then?
 
posted on April 28, 2016 by PeeHaa

# New commands - Added `!!rebecca` command - Added `!!wotd` command - Added `!!google` command # New features - Added special case support for `!!docs` plugin - Base setup for tests - Added tests from some low hanging fruit # Fixes ...

 
\o/ It's still alive
 
@NikiC HAHAHAH
 
@bwoebi as said, I think we might be able to forbid the case where $this is actually being used
 
7:47 PM
Mar 24 at 13:47, by NikiC
@bwoebi Unless you're thinking about vectors in a pre-banach space, nope
@NikiC yeah, but then you have the problem when it happens indirectly: static func calls non-static func (not using $this) calling another non-static func via Foo::bar() syntax
that's somewhat weird then
I think we need to forbid it in all cases, else we leave edge cases like that one open
 
Night! o/
!!version
 
class b extends a { function bar() { a::foo();} }
class a { function foo() { var_dump($this); } }
b::bar();
@NikiC ^ that must fail, right?
 
@bwoebi yes. I'm suggesting it to fail at the a::foo call
I'm seeing this, as usual, from an optimization perspective ^^
and for that purpose, it's only important that we never enter a $this using method with $this being null
 
@NikiC but then you cannot inline static calls between non-static methods
 
7:54 PM
even without getting into anything fancy, this allows use to eliminate the null checks we do on every UNUSED operator
@bwoebi not sure what you mean
 
you think something will come of this inlining stuff any time soon, or is it still far from useful ?
 
@NikiC if you'd inline a::foo() into b::bar(), we'd end up with function bar() { var_dump($this); } and it wouldn't fail (or fail too early) because there's no a::foo() call anymore
and thus you won't be able to inline these
 
When inlining it seems you'd need a way to still change context/scope.
 
uh, that's true
yeah, then you can do that check anyway there…
 
Depending on how expensive that is it may not be worth it to inline at all.
 
7:58 PM
from a practical perspective we can only realistically inline within one class anyway, so scope is not an issue
 
@bwoebi You mean with voting?
 
I mean, because we're limited to single files
 
@LeviMorrison yip
 
yeah, I was going to mention that ...
 
I don't know. I was hoping Dmitry would see that his RFC only has value if the nullable types one fails and let it go first.
 
7:59 PM
@NikiC currently yes, but we may want to add an option to leave that restriction for chosen subpaths
 
well it's a limitation of opcache right now isn't it ?
 
@JoeWatkins yes, it is, and I'm proposing to selectively unrestrict it.
 
He doesn't seem to trust me with Nullable types anymore.
 
@LeviMorrison looks like … you indeed put the nullables on hold for like 15 months
 
And that time doesn't even matter.
It wasn't going to make it into 7.0
And we are still in time for 7.1
Dmitry even said earlier that nullable types and unions should go to vote together.
 
8:02 PM
I agree with you, just explaining you Dmitrys perspective
@LeviMorrison I think that's even not a bad idea
We then basically have two RFCs in parallel:
 
I wanted to make sure they'd be compatible; that doesn't mean I want only union types.
 
union types (unions yes, no; if nullables pass: disallow ?, allow only |null, yes, no)
nullable types with ? (yes, no)
 
I'm not sure where you see them as incompatible, say nullables goes to vote and chooses ?, does that stop another vote choosing | null in unions ? does it stop unions supporting ? if internals doesn't vote for | null ?
 
@Levi and then, in case nullables don't pass, we can do a RFC with only |null yes, no
 
I'm saying they are orthogonal, but some people don't want ?int and int | null.
 
8:06 PM
@LeviMorrison that's why that second vote in unions RFC
 
yes, but they know what is coming, they are going to vote on nullables with knowledge that unions are in the pipeline, won't they just choose what they want, regardless of the order of voting ?
 
@JoeWatkins no, you should vote no on nullables if you don't want ? at any price
2 mins ago, by bwoebi
@Levi and then, in case nullables don't pass, we can do a RFC with only |null yes, no
 
@bwoebi I know, I was also surprised :-P
 
hehe
 
@bwoebi I'm sure people can figure out how to vote ...
 
8:17 PM
@JoeWatkins I think so too
 
all of this goes away, if you just do an RFC for resolving the two questions "use ? or | null" and "apply to params" ... doesn't need to be an implementation for that, then all of us can move forward, with unions, intersections, typed properties ... can't we do that ?
 
@JoeWatkins and what's with these who then want both ? and |null?
 
that can be an option, can't it ?
I'll bet most people aren't crazy :)
 
or people may only want null | if union types pass and otherwise no nullables at all
 
well if they aren't asked those questions, they can't votte on them can they ?
 
8:19 PM
@JoeWatkins I'm not certain Dmitry would even agree to it.
 
the only questions we need answers to are those two, right ?
"none" may also be an option ...
 
I think I have the implementation for short-hand nullable types done.
Just re-running tests now.
Still needs tests and whatnot but it is there.
 
@JoeWatkins You'd need to have three vote widgets: ? or none; | null or none; if both pass (50% vote): only |null or both
 
what if we draft an RFC now to try to resolve these questions, and I'll see if dmitry is up for letting it go straight to vote, so we can move on ?
 
I don't think Dmitry wants any more RFCs or discussion.
 
8:22 PM
if we put the questions sensibly, we will get sensible answers ...
 
I'm really not sure what he wants.
 
well tough shit ...
 
He seems to completely distrust me.
Won't talk at all.
He's not even consistent with himself; he says we need to delay the fix for the bug we found until nullable types or unions but then doesn't want nullable types to go to vote or something.
 
he is annoyed
we should extend the courtesy of asking him if he minds, but he doesn't get to decide what happens on his own ...
 
I did ask.
 
8:25 PM
guise can we just vote on nullables as is
 
And he's not happy with it (nor do you seem happy about it)
 
@NikiC which one ?
 
@JoeWatkins levi's rfc. no options no nothing.
include an extra vote in union types to switch nullables to |null
 
I'm also up for that ...
but
might annoy dmitry ...
 
If you guys are fine with me citing you as support for that decision I'll do it.
Something to the effect of "after talking with Joe, Nikita and Bob I've decided to put nullable types to a vote..."
 
8:28 PM
is dmitry on irc now?
 
and explain the adjustments to union types.
 
@NikiC He hasn't been on IRC for 3 days
 
He wasn't earlier; dunno right now.
 
probably closed his window accidentally
 
Which is part of the issue.
 
8:28 PM
he's not
 
I did try to reach out to him in chat.
It has to all go over ML...
 
I'm up for it, because whatever moves us forward, in a simple way ... but not totally happy with it ... I'm not sure why levi's should go first, if dmitry's doesn't conflict ...
which it doesn't ...
 
they are practically the same
only diff is argument types right?
 
Except dmitry's is only return types.
 
yeah
 
8:31 PM
Which is why I don't understand his resistance.
He said it himself: his doesn't actively discourage parameter types.
 
just looked at dmitry's rfc
it has argument types as an extra voting option
is that okay for us?
 
yes
 
If so we may as well vote on his rfc
 
In that case Levi shall just mail Dmitry to put his RFC to vote
 
@LeviMorrison what do you think about voting on dmitry's?
 
8:37 PM
and then we start vote on union types as soon as it's ready with an option to convert from ? to |null
 
@NikiC Why his and not mine?
 
@LeviMorrison to appease him
 
@LeviMorrison the difference is only that he has an extra option for argument types
 
(because - even though I'll vote no on his RFC - I'm pretty sure it'll anyway pass…)
 
why will you vote no on it?
 
8:39 PM
Bob wants long-form only.
 
because I don't want ? return types
(In case the vote on replacing ? by |null will fail)
 
do you mean short form only ?
 
no, long form only
only Foo|null
 
oh sorry I read because where it says Bob
oh it changed ... gotcha ...
 
more visible and better compatible with unions.
I definitely don't want to end up with ?Foo|Bar
 
8:40 PM
@LeviMorrison so, do you have a problem voting on dmitry's rfc?
 
I see no point in voting on his instead of mine.
His RFC is kind of lacking.
 
> I don't see a big reason to extend PHP with both possible syntaxes, so this RFC competes with “Union Types” and only one should be selected.
 
The RFC should also serve historical value and documentation value.
 
@JoeWatkins where's that from?
 
I've tried several times to just get him to use mine.
 
8:42 PM
his rfc
 
Even before it hit the list.
 
o_O
 
I think this was written before he saw multi types patch, future scope section ...
@Levi if they both answer the same question, did you really have legitimate reason to block it in the first place ?
 
He only added the section about params recently.
It was not the same as mine previously.
 
that should have been the day we moved forward ...
since it's the same, this is now a non issue, right ?
if we can edit the future types section so that the vote is fair, you'll be happy to move forward, surely ?
 
8:47 PM
@JoeWatkins edit in what way?
 
if you are concerned about the content of the RFC, you are more capable than Dmitry is of improving it, having a superior command of written language to Dmitry ...
there's no reason it should be nullables or unions ...
 
You think at this stage he'll willing let me edit his RFC?
 
one of us will do it
if he won't do it himself
I think he probably will do it himself ...
happy for us to email and ask him to edit that section and then put it to vote ?
 
I've already emailed him asking some clarifications.
(off list)
We'll see what he says.
If all goes well we'll be voting on some form of nullable types RFC tomorrow.
 
I agree the content is lacking by the way, his code is much more fluent than his written language, so I tend not to care ... if someone can improve it if it's accepted, that's great ...
 
8:53 PM
If not I'll let you know that I'd like your help.
 
okay cool
 
Sound good to you guys, @bwoebi and @NikiC?
 
@LeviMorrison \o/
 
9:29 PM
Okay aside from the following bit I think I have it implemented:
> Parameters with a nullable type do not have a default value.
 
Wes
@bwoebi still around?
 
@Wes haven't disappeared from earth yet
 
Wes
:P
sure you can move to mars, but you wouldn't do that to php
 
@Wes well, actually, doesn't seem like you'd have any issues with up to 20 minutes delay when coding on php-src
 
Hmm... I'm suspicious because I appear to have gotten the not-a-default bit for free...
 
9:33 PM
@LeviMorrison what do you mean?
 
function f(?callable $p) {}

f();
This correctly failed.
 
Wes
@bwoebi what do you mean?
 
yes
@LeviMorrison you do, because it's about require_num_args
 
I thought it would succeed based on how I reused the allow_null stuff.
 
no
 
Wes
9:34 PM
i have an issue with generators, maybe it's a feature request
 
20 minutes is the delay only if you're working with a connectionless network protocol. Over TCP, it'd be 120 minutes per message.
 
Wes
wouldn't be ok to automatically consume the iterator when it gets garbage collected?
 
@Ghedipunk that's why you'd send the messages multiple times
@Wes not really… but if you need that, that's what finally is for in Generators
 
Hmm; it's not important for me to test stack traces in my ouput; do we have a way to disable that?
 
Wes
function test(){
yield 1; yield 2; yield 3; $this->complete();
}
 
9:36 PM
@LeviMorrison no.
 
Wes
@bwoebi oh, example?
how do i execute complete() regardless the iterator was consumed or not, when it gets garbage collected?
 
function test() {
    try {
        yield from [1, 2, 3];
    } finally {
        $this->complete();
    }
}
 
Wes
lemme try it
 
@Wes Still working on your splice thing?
 
(the yield from is just a compact yield 1; yield 2; ...^^)
 
Wes
9:38 PM
@kelunik kinda
 
Is there a standard way to do that in an expect if?
--EXPECTF--
Fatal error: Uncaught TypeError: Argument 1 passed to f() must be callable, none given, called in % on line %d and defined in %s:%d
 
@LeviMorrison no, hence I've said no.
 
What more should I add?
 
Wes
 
you need the full trace
 
9:38 PM
If we ever change our testing infrastructure this could break all our stack traces...
(by adding another line or something)
 
@Wes you need to prime the generators at least once
execute ->current() or ->valid() on them
@LeviMorrison I know, but that's what batch replacing scripts are for…
 
Wes
within the finally?
 
@Wes no, on caller side
 
3v4l.org/q4rYN vs. 3v4l.org/LbZXV < Interesting.
 
@kelunik yeah, was a bug I've fixed in 7.0.4
 
Wes
9:41 PM
@bwoebi i don't want to be forced to touch the iterator on the caller side
 
@Wes There's no way around it.
 
Wes
ie i want it to be consumed before it gets garbage collected
aw.
 
@Wes start it yourself
 
Wes
was trying that
 
function test() {
    $gen = (function() {
        try {
            yield from [1, 2, 3];
        } finally {
            $this->complete();
        }
    })();
    $gen->valid();
    return $gen;
}
^ that way round
 
Wes
9:43 PM
it's hella ugly tho
 
/cc @bwoebi @NikiC @JoeWatkins
 
Wes
thanks tho @bwoebi thats better than nothing :B will wrap that behavior in a custom function
 
@LeviMorrison I've replied Dmitry (sigh)
@Wes yes, I agree. I still think Generators should have been auto-primed ... (\cc @NikiC add this to the collection of use cases where autopriming is useful…)
 
Wes
i have no opinion on this as i don't even know what i'm doing. i barely get how finally works :B
not used to these things yet
 
@bwoebi I'm not certain what he means by #2 and #3.
"No" implies that's not why he's separated the votes.
 
9:51 PM
@LeviMorrison I think he wants to vote yes on return nullables and no on parameter nullables
 
The problem with his reply to #2 is that it's all about default values.
And he said:
> not necessary, if we don't take default values into accoun
I'm not sure what that means when you throw out the only thing that was being asked about...
 
oh
 

« first day (2021 days earlier)      last day (2930 days later) »