« first day (2056 days earlier)      last day (2908 days later) » 

6:00 PM
We would need to change allow_null to include whether it is implicit or explicit.
That would potentially affect extensions.
 
@bwoebi "Otherwise PHP's casting rules are applied in an order to be as lossless as possible. PHP's weak-type casting rules are complex, which leads to a seemingly complex set of rules for casting types, however these rules are not an invention of this proposal. This RFC applies PHP casting rules in a sane way to convert a value to a type accepted by the union whenever possible."
Something along those lines. Maybe then completely eliminating the first sentence of the paragraph after the rules.
 
/cmd+c
 
hi, can someone tell me the name of the tv-show with a guy driving a bicycle in the trailer, plays in L.A. I guess
he lost his license ;)
 
Bummer, Dmitry isn't in IRC.
 
@bwoebi so the number of a CV will never be the same as the number of a TMP, or CONST, or anything else? I could, then, use that number as a unique identifier (in a given scope)?
 
6:06 PM
@NikiC What's your off-the-cuff opinion on changing allow_null in arg_info to be an enum that has implicit and explicit info? It's currently a zend_bool, so maybe not an enum formally so that it doesn't affect layout.
 
@Dereleased the EX_VAR_TO_NUM()? yes. (as long as you don't conditionally subtract last_var or similar) … For CONST, that's something else, they do a lookup in op_array->literals
 
@LeviMorrison why?
 
For distinguishing between Foo $bar = null and ?Foo $bar.
 
Why?
 
Reflection is one place that could benefit.
 
6:08 PM
hi
 
Or rather, why do you want to distinguish between Foo $bar = null and ?Foo $bar = null
How does reflection benefit?
 
Different __toString should be obvious…
 
@bwoebi Actually, I don't think I need to worry about const right now. op_array->last_var will give me a count of vars used, then?
 
And actually it's more like detecting ?Foo and Foo $bar = null.
There should not be any difference (except maybe for string serialization) between Foo $bar = null and ?Foo $bar = null.
 
@LeviMorrison For ReflectionType?
That shouldn't be different
 
6:11 PM
@NikiC Correct.
 
@LeviMorrison In that case big -1
Don't require special treatment just because people use explicit nullability
 
So you want to push all the generation of ? and = null to users.
Correct?
 
If that is what they're doing, yes. They should choose what is appropriate (e.g. for codegen, which version they are targeting)
though usually it will not even matter
 
Okay.
Okay, now assume for a moment that union types is accepted.
?Foo should be either:
1. ReflectionUnionType(ReflectionClassType(Foo), ReflectionBuiltinType(Null))
2. ReflectionClassType(Foo)
You want the latter, correct @NikiC?
 
@Dereleased of CVs, yes.
 
6:15 PM
Hello guys
I have a problem with my cake php someone can help me?
 
@LeviMorrison yes
 
@bwoebi What about a count of all vars used?
 
@NikiC Any reason aside from backwards compat for Foo $bar = null?
 
@Dereleased That would be last_var + T
 
@Dereleased last_var + T
 
6:17 PM
some know about cake php?
I need help pls
 
@LeviMorrison Mainly because of BC, but also because, as we have dedicated support for nullable types, we should represent it as the "simplest" normalized type, which in this instance is a nullable type rather than union.
 
but it's not working
the cell is empty when I want to show the name of the another model
in a table
 
@bwoebi EX_VAR_TO_NUM(opline->result) also valid?
 
Anonymous
@JasonMonts paste your code somewhere of your model etc... :) Also Cake have a Slack group that offer great support, you may have better luck there. But someone may still help you here! :-)
 
ok
thanks
 
6:22 PM
@NikiC So would agree with normalizing Foo | Null to ?Foo in Reflection?
 
this is one of my tables:
<?php
namespace App\Model\Table;

use App\Model\Entity\Complejo;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;

/**
* Complejo Model
*
* @property \Cake\ORM\Association\BelongsTo $Ciudades
*/
class ComplejosTable extends Table
{

/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);

$this->table('complejo');
$this->displayField('idComplejo');
 
What about normalizing it at AST time?
 
And this is the other table
<?php
namespace App\Model\Table;

use App\Model\Entity\Ciudad;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;

/**
* Users Model
*
* @property \Cake\ORM\Association\HasMany $Complejos
*/
class CiudadesTable extends Table
{

/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);

$this->table('ciudad');
 
@LeviMorrison yeah
@LeviMorrison what does that mean?
 
evenin
@JasonMonts Cake is bad and you should feel bad
 
6:24 PM
why?
 
also, stop using active-record based ORMs
 
@NikiC Transforming Foo | Null and Null | Foo into ?Foo during compilation or earlier. Meaning it's stored in the simpler form, not the union form.
 
@tereško why?
 
because active-record pattern violates SRP in all but the most trivial use-cases
 
@LeviMorrison that probably already happens anyway
Not having looked at the impl
 
Anonymous
6:26 PM
@tereško why is cake bad? Jw.
 
Well, i don't know too much about it, I need a basic platform you know
I have to solve my problem right now
 
If it happens I'd guess here: github.com/php/php-src/pull/1887/…
 
@JasonMonts and to answer your earlier "why": because it is badly designed, filled with bad programming practices, violates every OOP principle, has frankly borderline-retarded community and is filled with global state // cc @JayIsTooCommon
 
I want to show in my complejo table
the name of ciudad
not the id
but the association is not working i think
because a have a blank gap
 
then write your SQL directly
 
6:29 PM
haha but i want to use like the php cake guide
 
Anonymous
@tereško huh, I didn't realise cake was frowned upon like that. Now I'm worried because cake is what taught me OOP, so I guess I may be wrong...
 
@tereško do you have a tutorial to show how to use correctly?
with OOP
 
no
 
Anonymous
@JasonMonts their slack group may be better to get help :) As cake isn't massively popular
 
Anonymous
@tereško btw, are you going PHP South Coast?
 
6:32 PM
nope :(
I will be waiting for VoDs
 
wiki.php.net/rfc/union_types#solution @Levi @Trowski like the table?
 
hey jay i can't fin their slack group
 
.. and now I must gt back to writing some ES6
 
@Dereleased sure (if result_type is VAR/TMP/CV)
 
@JasonMonts did you try googling "cake php slack group", or were you just looking under your bed?
 
6:34 PM
@LeviMorrison I'd rather normalize it the inverse way (i.e. as Foo | null)
 
@bwoebi Lovely, more disagreement ^_^
 
now im googling
 
haha
 
1 min ago, by Jason Monts
hey jay i can't fin their slack group
20 secs ago, by Jason Monts
now im googling
 
sorry for bother you
 
6:34 PM
@bwoebi Nice, though maybe you should use int/float instead of long/double.
 
what exactly were you doing to find it BEFORE googling?
 
@bwoebi what other type is there? CONST? When will the result type be CONST?
 
sorry for not be like you @tereško
 
@NikiC The BC break in question would be for the new ReflectionType only, which has only been around for one minor release.
 
@Dereleased UNUSED. Is the other one. I.e. no result.
@Trowski damn, for a moment I was so sure we'd use long/double in PHP… (and the inverse in php-src o_O)
 
6:35 PM
Does that affect your opinion at all?
 
guys, how can I define equality operator for a class?
 
@Victor You cannot hook into that operator.
 
@bwoebi Does that come up unexpectedly? i.e., will a function call in void context decide to be UNUSED?
 
@Victor stop pretending that PHP is some other language, please
 
@Dereleased no. … It just may sometimes not assign it (if it detects that the value won't be used)
 
Anonymous
6:36 PM
@JasonMonts Have you found it :)?
 
@tereško I am not pretending anything
 
Anonymous
@tereško ah, bummer
 
@bwoebi Well, are you talking about internal type conversion, or the type the function will receive?
 
Yes Jay, thanks
 
I thought there was a __equals()
or something like that
 
6:37 PM
@bwoebi ok, so just things which don't have a "return", e.g. assignment?
 
@Trowski the latter… I've just confused it
 
Anonymous
@JasonMonts good luck!
 
@Dereleased assignment do have a return
but e.g. throw does not
 
@bwoebi hehe, I thought so. I've typed double in 7 code. :-D
 
@tereško Why are you too selfish?
 
6:38 PM
@Trowski hehehe
 
@bwoebi assignment has a return in the language, but in the VM it doesn't because the "return" is just op1, right?
 
@Dereleased copies op1 to the return: lxr.php.net/xref/PHP_MASTER/Zend/zend_vm_def.h#2442
 
@bwoebi So a float given to a string|int param will cast to a string preferentially?
 
float int (exact match) string int boolean
^ says the table
so, a float(5) will be cast to int
a float(5.1) will be cast to string
 
Ok, the exact match confused me a bit.
 
6:42 PM
@Trowski shall I write (lossless) rather?
 
@JasonMonts why are you so entitled?
 
@bwoebi That's the only cast that seems weird to me.
int (only if lossless)
 
@bwoebi Can you investigate whether the autoloader is triggered currently? I suspect it is not.
 
haha I don't know this word. I win
 
@LeviMorrison on what function? ReflectionClass::__construct()?
 
6:43 PM
:D
 
@bwoebi Like a ReflectionParemter::getClass.
 
Morngin
 
@LeviMorrison It uses zend_lookup_class(), thus triggers the autoloader (and throws if not found)
 
Then I'd be fine with triggering the autoloader as long as we can not throw…
 
@Andrea Question… Is it now less scary the way presented now: wiki.php.net/rfc/union_types#solution? After all, we need some rules.
 
6:50 PM
It looks like zend_lookup_class returns null instead of throwing; is that correct?
 
@LeviMorrison yes.
The code calling it is throwing
 
Anonymous
o/ @PeeHaa
 
Ekn
evenin
 
Friday is so close I can almost taste it
 
Anonymous
!!rebecca
 
7:01 PM
@samayo Happy Prebeccaday!
 
Anonymous
Yup it's close
 
Ekn
@Jeeves <3
 
@Ekn I love you too :-)
 
Anonymous
@Jeeves
 
Anonymous
Heh..
 
7:13 PM
@Ocramius Thoughts?
 
@LeviMorrison But what about the allowsNull on ReflectionParameter? That should also return true on =null, ?Type and Type|null. So either you're introducing an extra inconsistency, or you're breaking that API
 
Anonymous
Eh £250 for a one day conference..
 
@NikiC I'm not sure why that would be broken?
allowsNull() is permitted on all ReflectionType instances.
That's because the implementation optimizes that.
 
@LeviMorrison I'm referring to the ReflectionParmeter API
That should return true for anything that ... allows null
 
And why would that be broken?
 
7:23 PM
Wait, maybe I have forgotten what we were talking about in the meantime
 
1 hour ago, by Levi Morrison
Okay, now assume for a moment that union types is accepted.
@NikiC Start there.
 
@LeviMorrison What does ReflectionUnionType::allowsNull return?
Whether there is a null member in the union?
 
Basically, yes.
It's O(1) because it's tracked by the engine anyway as an optimization.
 
In that case I'm not sure what the BC issue is
Unless the string representation is Type|null
The string representation must be Type with simply allowsNull true
 
The __toString() would probably change, yeah.
But the BC break would be only since 7.0, which is a much smaller BC break.
 
7:28 PM
 
@LeviMorrison in a call, invited @asgrim to join and comment
 
What sort of call? I can join a voice call if I'm allowed ^_^
 
I'm around, but can't chat now - I'll be around tomorrow though
 
@samayo yes I agree. The user has to pass unvalidated string contents into setName() (it was bulletproof right?) .. but the attacker has input a payload ... meaningless to upload images.. no.. you could do lots of fun stuff, like overwrite files
 
@LeviMorrison It might be okay. In that case it should consistently return '?Type', independently of whether it is explicitly or implicitly nullable
 
7:31 PM
@LeviMorrison just with a client :P
 
@Ocramius Ah, I misunderstood ^_^ Carry on.
@NikiC That's what I'd prefer.
 
Though this is not an edge case BC break. This will break virtually any code using ReflectionType
 
@NikiC Correct.
 
Which I don't think is acceptable
 
It seems really odd to me that the user of the API needs to reimplement rules for if ? is needed.
Seems like a good BC break and basically we fix it now or never.
 
7:34 PM
@LeviMorrison Are there intentions to create an RFC remove the ?Type notation if union types passes?
 
@Trowski It's presently a 50%+1 vote on union types RFC.
But I do not expect it to pass.
 
@levi @bwoebi might respond to you later, really can't now, sorry
 
@Andrea s/might/will/, then I'm fine :-)
@PeeHaa Awesome question, I've left a comment
 
Your comment is a dupe :)
 
damn
@NikiC how much code is using ReflectionType today? Adding unions anyway breaks it in some way as code is probably not prepared to parse "|" …
 
7:39 PM
:P
 
@NikiC On further inspection a few things aren't broken.
The most common use is just printing out the type.
What would be broken is code that casts to string and then tries to reason about it.
However, alongside this BC break is a set of enhancements that they could use without resorting to that anyway.
So I agree it is a BC break, but it's not quite as widespread as you stated and I suspect these codebases will want to use the new APIs anyway.
 
Out of curiosity, why the hate for the callable prototypes RFC?
 
@ircmaxell dunno… For me it's about return type variance that it restricts it too much IMO.
 
I think it had to do with return type enforcement or something.
I believe that's @NikiC's reason.
() => new Thing() should pass something expecting callable(): Thing was the thought.
 
yip
 
7:45 PM
In my mind that's not a reason to block it; that's reason to enhance it later ^_^
I'm glad the vote is at least as close as it is, which indicates the desire for such a feature.
 
I desire the feature too, but this IMO is strong enough to not wait for potential future enhancements
 
honestly, I disagree 100% about having implicitly checked signatures like that
 
@LeviMorrison that's what I'd expect, okay
 
we have typing. The entire point of typing is to enforce code structure
that's like saying "we don't care about structure anymore, at least in this one case. All other cases it matters, but this case it doesn't"
 
@bwoebi that's still, uh, complicated
 
7:51 PM
@ircmaxell as long as it doesn't hinder comfort (i.e. quick, short Closures), I'm totally fine with typing.
 
@bwoebi What's considered a core lib?
 
it should hinder them
 
@bwoebi I don't even know what it does now
 
unless you give the ability to infer the type of the short closure
 
@kelunik the most fundamental ones like file, DNS or process start
 
7:51 PM
which is 100% tangential to what's talked about here
 
@ircmaxell If we have that, I'm fine with it too. But as we don't have that, no.
 
@bwoebi I don't consider process a core lib. And DNS doesn't use observables or does it?
 
It's tangential, but a pre-condition in my eyes
@kelunik they all don't.
 
posted on June 02, 2016 by kelunik

- New `status` command - New `version` command - Better text UI

 
as said non-core libs
Aerys, redis, mysql, pgsql, artax etc. all use observables
 
7:53 PM
@bwoebi we don't have short closures today
 
evenin' o/
 
@ircmaxell Oh, you meant short Closures as in ~> … I meant "short" Closures as in size; i.e. function($x) { return $x->getNext(); }
 
@bwoebi that should not be dynamically typed (inference)
 
zf3 skeleton app pushed to develop \m/
 
because otherwise every method and function should be dynamically typed
which means the entire type model falls apart
and yes, it should be typed to pass a typed closure
 
7:57 PM
@ircmaxell That's why I'd propose to have them wrapped and delay the error until call-time
 
doesn't mean you can't still use callavble
@bwoebi which is idiotic
we're talking about type system design here
 
oh, from that perspective, you are right
 
I'm sorry, I'm pissed here because I see bullshit being pushed through with applause, and generally good things like this being rejected for bullshit reasons.
it's basically taking the robust type system that already exists, and shooting it in the foot
 
The general issue is that you won't be able to take a random callable (e.g. from PHP 5 compat code) … which doesn't have an explicit return type.
 
correct, and they shouldn't be able to IMHO
that's the ENTIRE POINT OF TYPES
you can't do that with an interface
for a reason
 
8:00 PM
Now you have to explicitly wrap it into function():MyType { return untypedFunc(); }
 
yup
 
and then we have nothing gained
 
sure you do
you have intent gained
you have safety at the library author level gained
 
@ircmaxell As we're already throwing around bullshit, I call bullshit on that conclusion.
 
the person building the adapter is responsible for error checking
@NikiC why? what's fundamentally different from an anyonymous function and a real first-class function that should affect its type signature?
 
8:01 PM
It is generally acknowledged in modern language design that closures should be inferred, while freestanding functions shouldn't be.
 
@ircmaxell but it isn't superior to auto-wrapping. The person passing it forward is still responsible for proper checking to pass the right function forward
 
@NikiC in a short-lambda, I can agree. In an anonymous function, I don't agree
 
Whatever opinion you might hold on it, it is definitely not the choice prevalently made in contemporary languages
 
however, that inference is generally impossible in PHP except in special cases, specifically due to the scalar type model
@NikiC show me a typed language that infers on a full anonymous function (not a short lambda, but a full anonymous function)
 
@ircmaxell Yes, it's not possible. Which is why signature validations for callables is a bad fit for PHP
 
8:04 PM
@bwoebi sure it is superior. It gives you a guarantee that isn't resolved at runtime
 
@ircmaxell C++ and Rust come immediately to mind
 
@NikiC totally disagree
@NikiC c++ uses types for anonymous functions
 
@ircmaxell err sorry, semi-wrong on that one (generic lambdas are c++14)
Replace c++ with c# then
 
@ircmaxell it guarantees just as much as a blind pass through of function() use (callable $cb):Type { return $cb; } … I realize what your point is, the intent. But if I do func($cb); I also have the intent to put that $cb there. … If we force people to make it explicit … well there's a fine line between helpful and being annoying to them. And I believe it's shifting more to the latter side.
@Andrea Why not? Is my wording bad? I'm open to suggestions.
 
@bwoebi I understand, and am not saying you're wrong there. I'm saying you're being different to the rest of the type system as implemented in PHP
if you want that, then pass structural typing in general
but don't mix structural and non-structural using the same syntax
 
8:09 PM
@ircmaxell What exactly do you understand under structural typing?
 
@bwoebi the prose we had before is dense but it's easier to parse than a table, I guess?
 
@Andrea Perhaps … I've been suggested it; I may revert it if it's worse
 
@bwoebi verify what you pass fits the structure of what was intended, rather than using the explicit "opt in" of the signature (interface)
 
@ircmaxell I'm not sure. Perhaps (I say perhaps…) we want classes more rigid (i.e. opt-in interfaces) and callables more dynamic (at least callables always have been quite dynamic, that'd be in line with that)…
@ircmaxell You've seen the functional interfaces RFC? If you want structural typing, it probably should rather have been something like that.
Because that actually is explicit opt-in like we have with interfaces currently
 
@bwoebi I have, and I think it's an interesting idea that screws the type system semantic meaning
@bwoebi please don't do that. Create a new syntax (like I did for structural typing) if you want to introduce a new mechanism for typing. Don't re-use the same syntax but drastically change behavior in small but subtle ways
 
8:15 PM
The way proposed here is some sort of an automatic run-time thing… I wouldn't quite compare it to interfaces
@ircmaxell eih, callable():RetType is a totally new syntax?
 
function(): retType isn't
which is used all over the place
 
To clarify: you want return type deduction or also parameter type deduction?
 
But I'm not talking syntax here.
@LeviMorrison parameter types are already deduced as per the RFC (contravariance)
 
(Also, here's a link to a reddit discussion regarding ReflectionType: reddit.com/r/PHP/comments/4m93s1/…)
/cc @Ocramius @Asgrim @Andrea
@bwoebi function ($x) { return $x * 2; } has the type of $x inferred?
 
@LeviMorrison with opcache, yes.
In general, no.
 
8:20 PM
@LeviMorrison oh cool
I'll keep an eye on that thread I guess
 
@Andrea So, shall I revert it again?
 
b.thumbs.redditmedia.com is generally being slow or dropping my connections or something :/
 
@bwoebi that might be a good idea, I'd get a second opinion…
 
Let's ask @Levi ... :-)
 
gonna go play video games because reasons, ttyl
 
8:22 PM
@Andrea reasons :-)
 
Anonymous
@Jeeves Please tell me what the last hour of conversation means. Thanks.
 
@JayIsTooCommon You're welcome!
 
lol
 
Anonymous
.. Feels like you didn't listen to my question there, but ok.
 
attitudinize to bot
 
8:38 PM
Anyone have feedback on this juicy getopt idea? news.php.net/php.internals/93627
 
8:49 PM
@LeviMorrison nothing is inferred, it's just that @bwoebi doesn't have a problem with parameter types because you don't need to specify them in your closure at all, because they follow contravariant rules
 
Is any word like "blabering" wich means "talking too much" ?
 
Return types, on the other hand, follow covariance hence can not be dropped
@ircmaxell apart from what was discussed already, some people also don't like the fact that you can construct a callable type in the parameter definition and would rather see this being done in typedef declaration only
(which I don't like as it'd be "arbitrary expressions" all over again)
 
@bwoebi you still about?
 
@Dereleased yes
 
what is needed to get something to compile as a zend_extension .so like opcache?
 
8:58 PM
@Dereleased I think it's about the zend_extension struct which needs to be provided instead of/in addition to zend_module_entry struct
I'm not an expert in that area.
 
I think so, xdebug is a good example github.com/xdebug/xdebug/blob/master/xdebug.c#L2724
 
@Dereleased relevant function here: lxr.php.net/xref/PHP_MASTER/Zend/zend_extensions.c#28
so, some symbols need to be provided
 
I think xdebug is both a php extension and a zend extension
 

« first day (2056 days earlier)      last day (2908 days later) »