« first day (2052 days earlier)      last day (2896 days later) » 

Wes
12:00 AM
must be because people don't want to do "implements X" on existing callables
 
In Symfony how do the clear the email spool so it doesn't send any queued emails
 
12:23 AM
@bwoebi thanks! I already see the failures on by-ref, btw
 
o/
 
will write some more tests around the various proxy types. For now got a null assigned to a string-hinted field. Possibly a bug in typed-properties, but not sure yet
hmm, yeah, seems to use null for the null object pattern
not sure how to deal with that (yet)
 
12:42 AM
ok, I found one scenario that cannot be handled without by-ref properties -.-
and it is safe to use by-ref there
aaand off... speaking in few hrs...
 
1:14 AM
@Ocramius May I argue that you could you __set() with a bound closure to proxy the assign instead of using a ref?
 
Not possible. That's the other proxy type, btw
 
@Ocramius why not?
 
this is basically what friend objects tend to do btw
 
What is special on this case that you need references here?
 
basically, this is because of those frikken fluent interfaces
 
1:17 AM
Oh, I see
Well, we may allow the special case of by-ref assign from typed property to another typed property of the same type
 
class Counter {
    public $count = 0;
    public function increment() { $this->count += 1; return $this; }
}
class EchoLoggingCounter extends Counter
{
    private $counter;
    public function __construct(Counter $counter) { $this->counter = $counter; }
    public function increment() { echo 'banana'; return $this->counter->increment(); }
}
this is the classical example
 
would need a special opcode, but doable
 
if you run (new EchoLoggingCounter(new Counter()))->increment()->increment()->increment() it echoes only once
just quickly skimmed the code: seems like by-ref is easy to re-enable
 
@Ocramius the problem is not by-ref, the problem is that we have no control about the values after by-ref assigns
 
I am aware of that
I don't think that's a problem though
 
1:20 AM
in the special case of by-ref assign from typed property to another typed property of the same type, that's given…
 
by-ref escapes type checking even for typed function params
I think the semantics are ok therefore
 
@Ocramius no?
 
function foo (Bar & $bar) {
    $bar = new Baz;
}
 
well, that's intended
the hint is on the passed param
what you do afterwards is not important
 
yes, what I mean is that by-ref is a squishy ball of bullshit anyway. I wouldn't disable it for the sake of disabling it
 
1:22 AM
but the guarantee of typed props is that the value actually is the value of the type
 
the guarantee would just be broken in that case
the engine does not need to concern itself with this sort of thing, IMO
this is just the user voluntarily doing these things... I think it's an acceptable scenario
this also leads to the un-initialized state question btw
since I cannot take a reference from an object with uninitialized typed properties... also problematic
 
@Ocramius and will get undefined behavior whenever we introduce a JIT?
 
I think this will end up simplifying and removing a lot of the limitations
I don't think you can JIT anything with by-ref stuff anyway
it's too squishy
we can probably remove by-ref semantics completely from the language if that is a problem later on. Not sure what the implications are (massive BC break, ofc)
 
removing by-ref is obviously not an option, except if you want to pull a python 3
 
yeh, I know
anyway, removing the limitation is sufficient. Having JIT bail out on anything by-ref is a better solution than damaging the semantics of the language only for a certain sub-section of it
same probably goes for reading typed properties... can remove the checks there too, and leave them on write, I suppose
 
1:27 AM
@Ocramius the problem is that you have to internally check each and every time for by-ref
 
I'll see further when writing more tests... take last sentence really lightly
 
you don't have control about the outside
 
@bwoebi that's not a problem. By-ref is way below the 80/20 scenario
so we're talking about pennies, optimization-wise
 
@Ocramius you need to check whether you have to bail out
 
yeh, but that is an implementation detail for future scope, IMO
 
1:29 AM
Also, bailing out in the middle of a function is not inexpensive and may even be really hard with sufficient optimizations
 
it might be super-expensive, but it's still below the 80/20 by a lot
current limitations smell like feature creep to me atm
 
That's not the point. It's super expensive complexity wise in implementation
 
yes, but there is no implementation
that's why it's feature creep
as I said before, the cleanest implementation would be zvals carrying type information. I'd rather explore that area, even if I know that the current preliminary opinions are that it's gonna cause a massive perf impact
 
As said, the type of a typed property must always match its type
 
it would have the advantage of making the language fully typed, and then you could JIT it again
@bwoebi that doesn't fit current PHP semantics, as I demonstrated above. While I know that it is unorthodox, this is what is happening in the language
so at the moment, implementation details on future scope seem to creep into the language spec, creating more edge case scenarios IMO
 
1:32 AM
@Ocramius You demonstrated something unrelated
types are on accessing/setting boundaries
 
what of this is unrelated?
 
whatever is outside of these boundaries is irrelevant
@Ocramius foo requires Baz to be passed in. That's all the type guarantees
whatever happens afterwards is irrelevant.
 
same stuff: 3v4l.org/X8RS7
you can make it as private as you want, it becomes a mess regardless
 
and the same applies here
 
plus there's all that stuff around sort() and similar
 
1:36 AM
but typed properties have a guarantee on get and on set.
 
and a ref is neither a get nor a set
 
In PHP (until now) we just type values, not references.
 
the target location (reference var) is what is set
correct, so I'd not add type checks there
it just adds more "funny" rules that will just land on phpsadness, IMO
again, typed properties are gonna be such an edge case that killing the entire JIT for an entire process, and hoping for the user's fair usage ("it's your problem now") is better, IMO
 
the JIT is not the issue here.
 
from my code PoV, I'd never break the contract about the types, for example
I'm not actually changing the types, because I know what I'm doing there
 
1:39 AM
@Ocramius you'd never intentionally do.
types are there to prevent you from doing it unintentionally
 
right, but the code seems to protect against that, while IMO it should be scope for future research
as in "how to prevent instance property reference types to be changed at runtime"
the current imposed limitation is a simplistic solution that doesn't solve anything, that's the problem
it imposes a limitation because "there be dragons"
 
@Ocramius the normal $foo->bar = $baz; code protects against that. $ref = $baz; code does not know anything about the property type
 
I am well aware of that
what I'm saying is "let it be"
it will crash on property read, if assigned a wrong type
 
@Ocramius and that's a problem
 
it will not crash on reference read, because that's out of scope
@bwoebi why is it? From a userland perspective, it's basically like a function returning something unexpected
this happens all the times and is trivial to debug too
 
1:42 AM
@Ocramius This is btw. what the patch did initially and had very significant performance impact.
 
and it's a very typical debugging scenario
@bwoebi then let's not check the type on read either
assume good faith there, and assume that by-ref is < 5% scenario anyway
 
@Ocramius which is, not an option.
 
why not?
 
Wes
is is_callable result affected by visibility, right?
 
you can do that in your code.
The language cannot.
@Wes yes.
 
1:43 AM
I did not understand your answer
 
@Ocramius You can target users who know to write code and whom you can trust with good faith. The language targets generically and does not do any assumptions.
 
No, this is a mistake. You can simply document that this sort of hack is possible and should not be done. Once we are able to type-check references, we can fix that.
 
Sorry, but this definitely is not an option, under no circumstance.
 
no, you are absolutely being short-sighted here
1) we are talking about an edge-case feature (by-ref object properties)
 
@Ocramius then go write python. The hints aren't enforced there. Seriously.
 
1:45 AM
2) we are talking about a bug caused by misuse of those
3) this sort of limitation can be documented and agreed as a "to be fixed"
unless there are security issues related to memory access, I don't see a problem here
or even RCEs or such.
 
@Ocramius there aren't at least as long as we have no JIT.
 
STOP TALKING ABOUT THE FUCKING GIT IF THERE AIN'T NO FUCKING JIT YET!!!111ONE
that may be PHPNG-NG-NG
 
I'm just saying that this one is not a problem…
1) It is an edge case. But not a particularly rare edge case.
2) s/misuse/bug in the PHP code/
3) sure, you could do that. But it's horrible.
Allowing this would be a terrible mistake, IMO.
 
so... I suggest this
a list of scenarios (bad ones) where type is changed by-ref
@bwoebi it may be horrible, but you break existing use-cases, making it impossible to implement them
 
Wes
is there a way to disable phpstorm showing me static methods autocomplete on ->?
 
1:49 AM
so the trade-off is acceptable here
 
@Ocramius the only scenarios are obviously these where the programmer makes a mistake
31 mins ago, by bwoebi
Well, we may allow the special case of by-ref assign from typed property to another typed property of the same type
 
@bwoebi then let him make the mistake there. Checking only on write is perfectly acceptable
@bwoebi that may work, although it will break any by-ref assignment to intermediate untyped vars
 
@Ocramius but you can work around that.
 
yes, possibly
@_@
oh well, I need sleep
 
Good night
@Ocramius If you really need that (you seem to), then please try to persuade Nikita too.
 
1:52 AM
yar, will think about it... maybe fiddle with the code too
 
perhaps you have better ideas after a good sleep… sleep well ;-)
 
 
1 hour later…
3:12 AM
I'm curious because if you look at the AST, the last statement in the statement list isn't actually the function calling itself.
Or maybe I'm wrong.
Anyone that understands the interpreter's internals better please feel free to clarify.
 
3:51 AM
moin
answering that means reading really complicated code for 5am ... the rules about when a opcode handler can use tail call are not exactly clear or simple @Sherif
 
@JoeWatkins If it was clear or simple to me I wouldn't be asking :)
 
17117#if 0 || (IS_CONST != IS_UNUSED)
17118    USE_OPLINE
17119
17120# if 0 || (IS_VAR != IS_UNUSED)
17121    if (EXPECTED(1)) {
17122        ZEND_VM_TAIL_CALL(zend_binary_assign_op_helper_SPEC_VAR_CONST(add_function ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
17123    }
17124# endif
17125    if (EXPECTED(0)) {
17126        ZEND_VM_TAIL_CALL(zend_binary_assign_op_dim_helper_SPEC_VAR_CONST(add_function ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
17127    } else /* if (EXPECTED(0)) */ {
17128        ZEND_VM_TAIL_CALL(zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(add_function ZEND_OPCODE_HANDLER_ARG
is there ever really a good reason to write code like that ...
I'm gonna say it doesn't
 
What the heck does EXPECTED do there? Is that a macro?
 
yes
branch optimization
 
Oh that's generated code isn't it.
hmmm
 
4:06 AM
yeah
 
It's the variable that would prevent it here, isn't it?
more specifically the variable assignment.
I thought returning from assignment first as the base case would allow it to use tail recursion, but oh well.
bleah, oh well
thanks @JoeWatkins now at least I know where to dig deeper
 
I think you may want to dig around in optimizer also ...
I'm not even sure if tail recursion optimization is used at all, at a user level
(I think it's not)
 
4:22 AM
@JoeWatkins You mean it's not used for user defined functions?
 
yeah, unless opcache maybe does something
I don't think it does either ... look at generated opcodes
phpdbg -p* /path/to/script.php
@LeviMorrison this "g a" shortcut on php.net, why does it look like crap ?
it feels as if it was just not styled, maybe you didn't know it was there ?
(I didn't)
 
Wes
90% of php.net's js is broken that way
 
someone should fix it, I quite like that quick search thing
 
Wes
imho it's ancient stuff
what was supposed to do that one?
 
4:37 AM
use different words
 
Wes
it's probably meant to be like that
 
hmmm, I really can't figure out a sensible way to do this :/
 
Wes
going to sleep a bit. later
 
lata
if some symbol is exported, but there is no forward declaration in a header - so that trying to use the symbol externally to php will raise undefined symbol warnings in compiler - and I export the symbol properly with a forward declaration, that's not an ABI change, right ?
because it is already exported
just not right
 
5:01 AM
I'm really starting to wonder if this kickstarter campaign will be a success or a miserable failure.
 
campaign for what ?
 
@JoeWatkins I'm starting a kickstarter for a new learning platform I'm building. Basically it's like an LMS for PHP. You can create content (video/text/diagrams/etc...) and add coding exercises that can be automated
A very crude prototype of what that would look like phpden.info/skittlez/invite/…
It just takes the AST and you can writests tests against it to determine if the thing you're trying to teach them got across.
 
that's pretty cool
 
Kinda like codecademy, except way more sophisticated than just checking the script's output. It can actually analyze the AST for things and give you hints/tips along the way about the excersize.
 
I like, but why does it need funding ?
not going to be open ?
 
5:11 AM
Hosting, producing all the content, etc..
 
so it will be open ?
 
You mean open as in open source or as in free?
 
I meant the former, but now I wonder the about the latter also ?
(I assumed it would be free, am I wrong?)
 
Well, I haven't really decided yet. The idea is to build a platform not necessarily provide an open source tool.
My take on it is make it free for students and open source projects.
It's a long term enterprise play (charge companies to use it as a screening tool for higher php candidates, for example).
At least at first, I don't want to clutter it with poor content. Might just make it invite only for a while.
 
I see
 
5:16 AM
The idea is really: you introduce a new concept through a short (1-2 minute) video like say (what is an array in php?) https://www.youtube.com/watch?v=yENNhMtc4nI

Then you ask them 1 or 2 multiple choice questions about the concept they should have grasped from the video (array elements in PHP are made up of? a) key/value pairs, b) indexes ....)

Then you give them some article/tutorial to really absorb the technical guts of that concept

Finally, you give them a coding excersize to apply that knowledge in practice and test if they got it
Conceptualization -> Measurability -> Knowledge -> Measurability -> Practice -> Measurability
If you think about it, it really is a far more effective way to teach someone to code that didn't go to school then just "here's a book and some tutorials get to work..."
 
it's a good idea, but I'm not sure what the incentive is to fund it if it's not going to be open and or free ?
 
@JoeWatkins It would be free to the end-user. The monetization aspect is to create a b2b paltform. But in order to keep the community behind it realistic I want to start with either invitation only or just open to students with .edu emails or something.
Additionally, the idea is to provide an REST API that you can use to program your own tests.
So you don't have to store the coding excersize itself on the platform.
 
okay, so there's incentive for the people you're selling too, companies that might use it or whatever ...
 
Yea, it's tricky.
I'm not sure how to go about it exactly, but slowly trying to figure that out.
 
as you can tell, I'm pretty clueless, and won't be of any help, at all ... I like the ideas anyway ... one of the most costly things where I work is the education process, I could imagine that we could develop a much better one with tools like that ...
people have started, and left months later without ever having written a single line of code ...
some people have worked there for a year and can't setup their own computer to run our software
I'm almost sure we would use it if it were available, but would they fund it to get going is another question and I dunno the answer ...
 
5:27 AM
Yea, who knows. Either way, I'm going to try. Even if the kickstarter doesn't get funded I'll still put my own money into it. I just really want to see this thing come to life :)
 
cool project ... I think you loose a lot if it's not open source ...
 
@JoeWatkins I take Google's approach to "default to open" here. The platform should definitely be open, I agree to that. But opening up the code base just gives the competitors an unfair advantage to make the system worse.
I long have loathed the way codility does theirs, for example.
We can do so much better anyway.
 
I'm really only talking about the core analysis platform ... there's a distinct advantage in that part being open source ... probably disadvantages too, but unless you can afford to hire the kinds of programmer that come and work on stuff that's interesting for free, disadvantages can probably be discounted ...
 
@JoeWatkins Oh, that part is completely transparent. I use @NikiC's AST extension to spit out the syntax tree. Using the API you can set an end-point on your own server that will hand you the AST in JSON. You then do whatever you want with it to determine if the code passes your test and return the result back to the API.
Of course the idea is to have some premium library with content and coding excersizes for the masses, but really it's about building a platform more than a specific tool.
The beauty of it is that you can write it all in PHP. So technically I don't hide anything about the coding part.
 
6:13 AM
posted on May 29, 2016

New Cyanide and Happiness Comic

 
6:34 AM
@JoeWatkins docs should not use short options anyway ;)
 
Ekn
6:47 AM
mornings
 
7:08 AM
Hi
 
7:57 AM
o/
 
8:09 AM
@Gordon !!command alias...
 
Moin.
 
8:51 AM
@bwoebi by-reffing only against object properties with compatible type seems workable. I think invariance could be applied too
 
9:42 AM
morniongs
 
10:05 AM
morgfmn
 
10:19 AM
@bwoebi Not that you see, can you explain it to me as well?
I don't understand what problem this is solving...
@bwoebi I haven't followed the discussion, but there is absolutely zero chance that we will allow references if we can't guarantee the type.
 
zero
 
mugguh
 
The only, the one single constraint on this entire proposal, is that "Reads from typed properties always return the correct type".
 
that has to be so, or else it's worthless
 
So if you want to allow references, it's only going to be through "check the type on every read". And I doubt that this will be considered acceptable.
 
10:27 AM
I don't think there is opportunity to do that for references
once you've taken the reference, it can be used in any handler, that means changing all code that assigns, doesn't it ?
not sure why this conversation is happening again anyway
 
10 hours ago, by Ocramius
ok, I found one scenario that cannot be handled without by-ref properties -.-
(Though I haven't understood it yet)
 
why is that different to any other case ?
 
Don't ask me ...
It has something to do with fluent interfaces
 
In software engineering, a fluent interface (as first coined by Eric Evans and Martin Fowler) is an implementation of an object oriented API that aims to provide more readable code. A fluent interface is normally implemented by using method cascading (concretely method chaining) to relay the instruction context of a subsequent call (but a fluent interface entails more than just method chaining ). Generally, the context is defined through the return value of a called method self-referential, where the new context is equivalent to the last context terminated through the return of a void context....
I don't get it ...
it may be more to do with proxy objects
I can make sense of that ...
 
They are talking about references between too identically-typed fields. So like class Foo { public Foo $foo; } class Bar { public Foo $bar; } $foo->foo = &$bar->bar; should be type safe
 
10:37 AM
yeah, that's mentioned ...
 
@nikita2206 sure, that's safe. I just don't understand the use case
The particular one that is cited, I mean
 
I don't see what leads bob to say that this is a case we can handle on it's own, it's the same as every other case in that, it presents exactly the same problems, which we have no good solutions for ...
 
morning
 
moin
 
@JoeWatkins which one?
 
10:41 AM
I can't say the one that nikita linked too ...
but it's the one that nikita linked too ...
and also the one written out by nikita
the other one ...
this is hard ...
it doesn't really matter, my point is that regardless of the case, if we can solve the problems acceptably for one of them, then it's solved for all of them ... we can't solve it for any of them ...
unless I'm wrong and you see acceptable ways to do any of this ... I would love to be wrong ... am I ?
 
I was saying that $a = new class { public string $p; } $b = new class { public string $p; } $a->p = &$b->p; could possibly be possible…
 
how ?
 
because both have the same type hint
 
yeah, but how will you actually do it ?
 
extra opcode for property by ref assign …
 
10:47 AM
and if you can do it for that, why not allow coercion when assigning to a property of a different type, or assigning to an untyped variable that is eventually assigned to a type property ?
 
@JoeWatkins because types aren't enforced on that level anymore
Types are just consistent when all endpoints of a reference enforce a particular, invariant type
 
in the latter they aren't, but you could argue that from $var = &$typed->property; $var isn't a variable but a reference a typed property, why can't you assign $var to something of the same type ...
 
@JoeWatkins $var is a variable, holding a reference to a typed property.
And there's the problem, that $var is still a variable and not a typed one
 
cough we might have variables with locked type cough
 
variables can't hold enough information about their type to lock it
 
10:50 AM
@JoeWatkins they can, it's a one bit flag
 
@JoeWatkins we just would need another 8 bytes
 
on every zval ... that's half of the size of a zval today ...
 
@nikita2206 you get problems with nullables and even more with union types
 
it has to be acceptable ...
 
Though, strictly seen, we'd only have to type the zend_reference
But problem is that we everywhere just deref and then forget about the fact it was a reference
 
10:53 AM
we should only do what we can do well ...
I think taking it further than we have taken it requires a different approach, it requires a change of conventions, and advances in the type system that none of us can really imagine clear enough to communicate today ... piling on the opcodes, making special cases of things ... I worry we'll end up with something hard to understand, fragile to maintain, and difficult to interact with ...
making this one thing work just invites more questions than it answers ... why can't sort() and the like work, they don't and can't change the type, it's as type safe as that assignment ... why can't any other cases work ...
 

« first day (2052 days earlier)      last day (2896 days later) »