100 episodes

This is the 'PHP Internals News' podcast, where we discuss the latest PHP news, implementations, and issues with PHP internals developers and other guests.

PHP Internals News Derick Rethans

    • Tecnologia
    • 4.0 • 1 Rating

This is the 'PHP Internals News' podcast, where we discuss the latest PHP news, implementations, and issues with PHP internals developers and other guests.

    PHP Internals News: Episode 103: Disjunctive Normal Form (DNF) Types

    PHP Internals News: Episode 103: Disjunctive Normal Form (DNF) Types

    PHP Internals News: Episode 103: Disjunctive Normal Form (DNF) Types


    London, UK

    Friday, June 24th 2022, 09:07 BST



    In this episode of "PHP Internals News" I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about the "Disjunctive Normal Form Types" RFC that he has proposed with Larry Garfield.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:15

    Hi, I'm Derick. Welcome to PHP internals news, a podcast dedicated to explaining the latest developments in the PHP language. This is episode 103. Today I'm talking with George Peter Banyard again, this time about a disjunctive normal form types RFC, or DNF, for short, which he's proposing together with Larry Garfield. George Peter, would you please introduce yourself?


    George Peter Banyard 0:39

    Hello, my name is George Peter Banyard, I work on PHP paid part time, by the PHP foundation.


    Derick Rethans 0:44

    Just like last time, we are still got colleagues.


    George Peter Banyard 0:46

    Yes, we are indeed still call it.


    Derick Rethans 0:48

    What is this RFC about? What is it trying to solve?


    George Peter Banyard 0:52

    The problems of this RFC is to be able to mix intersection and union types together. Last year, when intersection types were added to PHP, they were explicitly disallowed to be used with Union types. Because: a) mental framework, b) implementation complexity, because intersection types were already complicated on their own, to try to get them to work with Union types was kind of a big step. So it was done in chunks. And this is the second part of the chunk, being able to use it with Union types in a specific way.


    Derick Rethans 1:25

    What is the specific way?


    George Peter Banyard 1:27

    The specific way is where the disjoint normal form thing comes into play. So the joint normal form just means it's a normalized form of the type, where it's unions of intersections. The reason for that it helps the engine be able to like handle all of the various parts it needs to do, because at one point, it would need to normalize the type anyway. And we currently is just forced on to the developer because it makes the implementation easier. And probably also the source code, it's easier to read.


    Derick Rethans 1:54

    When you say, forcing it up on a developer to check out you basically mean that PHP won't try to normalize any types, but instead throws a compilation error?


    George Peter Banyard 2:05

    Exactly. It's, it's the job of the developer to do the normalization step. The normalization step is pretty easy, because I don't expect people to do too many stuff as intersection types. But as can always be done as a future scope of like adding a normalization step, then you get into the issues of like, maybe not having deterministic code, because normalization steps can take very, very long, and you can't necessarily prove that it will terminate, which is not a great situation to be in. Imagine just having PHP not running at all, because it's stuck in an infinite loop trying to normalize the format. It's just like, oh, I can't compile


    Derick Rethans 2:39

    Would a potential type alias kind of syntax help with that?


    George Peter Banyard 2:44

    Maybe, I'm not really sure.

    PHP Internals News: Episode 102: Add True Type

    PHP Internals News: Episode 102: Add True Type

    PHP Internals News: Episode 102: Add True Type


    London, UK

    Thursday, June 2nd 2022, 09:06 BST



    In this episode of "PHP Internals News" I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about the "Add True Type" RFC that he has proposed.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:00

    Hi I'm Derick. Welcome to PHP internals news, the podcast dedicated to explaining the latest developments in the PHP language. This is episode 102. Today I'm talking with George Peter Banyard about the Add True Type RFC that he's proposing. Hello George Peter, would you please introduce yourself?


    George Peter Banyard 0:33

    Hello, my name is George Peter Banyard, I work part time for the PHP Foundation. And I work on the documentation.


    Derick Rethans 0:40

    Very well. We're co workers really aren't we?


    George Peter Banyard 0:43

    Yes, indeed, we all co workers.


    Derick Rethans 0:45

    Excellent. We spoke in the past about related RFCs. I remember, which one was that again?


    George Peter Banyard 0:51

    Making null and false stand alone types


    Derick Rethans 0:53

    That's the one I was thinking of him. But what is this RFC about?


    George Peter Banyard 0:56

    So this RFC is about adding true as a single type. So we have false, which is one part of the Boolean type, but we don't have true. Now the reasons for that are a bit like historical in some sense, although it's only from PHP 8.0. So talking about something historical. When it's only a year ago, it's a bit weird. The main reason was that like PHP has many internal functions, which return false on failure. So that was a reason to include it in the Union types RFC, so that we could probably document these types because I know it would be like, string and Boolean when it could only return false and never true. So which is a bit pointless and misleading, so that was the point of adding false. And this statement didn't apply to true for the most part. With PHP 8, we did a lot of warning to value error promotions, or type error promotions, and a lot of cases where a lot of functions which used to return false, stopped returning false, and they would throw an exception instead. These functions now always return true, but we can't type them as true because we don't have it, and have so they are typed as bool, which is kind of also misleading in the same sense, with the union type is like, well, it only returns false. So no point using the boolean, but these functions always return true. But if you look at the type signature, you can see like, well, I need to cater to the case where the returns true and when returns false.


    Derick Rethans 2:19

    Do they return true or throw an exception?


    George Peter Banyard 2:22

    Yeah, so they either return true, or they either throw an exception. If you would design these functions from scratch, you would make them void, but legacy... and we did, I know it was like PHP 8.0, we did change a couple of functions from true to void. But then you get into these weird shenanigans where like, if you use the return value of the function in a in an if statement, null gets because in PHP, any function does return a value, even a void function, which returns null. Null gets coerced to false. So you now get like, basically a BC break, which you can't

    PHP Internals News: Episode 101: More Partially Supported Callable Deprecations

    PHP Internals News: Episode 101: More Partially Supported Callable Deprecations

    PHP Internals News: Episode 101: More Partially Supported Callable Deprecations


    London, UK

    Thursday, May 19th 2022, 09:05 BST



    In this episode of "PHP Internals News" I talk with Juliette Reinders Folmer (Website, Twitter, GitHub) about the "More Partially Supported Callable Deprecations" RFC that she has proposed.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:14

    Hi, I'm Derick. Welcome to PHP internals news, the podcast dedicated to explaining the latest developments in the PHP language. This is episode 101. Today I'm talking with Juliette Reinders Folmer, about the Expand Deprecation Notice Scope for Partially supported Callables RFC that she's proposing. That's quite a mouthful. I think you should shorten the title. Juliette, would you please introduce yourself?


    Juliette Reinders Folmer 0:37

    You're starting with the hardest questions, because introducing myself is something I never know how to do. So let's just say I'm a PHP developer and I work in open source, nearly all the time.


    Derick Rethans 0:50

    Mostly related to WordPress as far as I understand?


    Juliette Reinders Folmer 0:52

    Nope, mostly related to actually CLI tools. Things like PHP Unit polyfills. Things like PHP Code Sniffer, PHP parallel Lint. I spend the majority of my time on CLI tools, and only a small portion of my time consulting on the things for WordPress, like keeping that cross version compatible.


    Derick Rethans 1:12

    All right, very well. I actually did not know that. So I learned something new already.


    Juliette Reinders Folmer 1:16

    Yeah, but it's nice. You give me the chance now to correct that image. Because I notice a lot of people see me in within the PHP world as the voice of WordPress and vice versa, by the way in WordPress world to see me as far as PHP. And in reality, I do completely different things. There is a perception bias there somewhere and which has slipped in.


    Derick Rethans 1:38

    It's good to clear that up then.


    Juliette Reinders Folmer 1:39

    Yeah, thank you.


    Derick Rethans 1:40

    Let's have a chat about the RFC itself then. What is the problem that is RFC is trying to solve?


    Juliette Reinders Folmer 1:46

    There was an RFC or 8.2 which has already been approved in October, which deprecates partially supported callables. Now for those people listening who do not know enough about that RFC, partially supported callables are callables which you can call via a function like call_user_func that which you can't assign to variable and then call as a variable. Sometimes you can call them just by using the syntax which you used for defining the callable, so not as variable but as the actual literal.


    Derick Rethans 2:20

    And as an example here, that is, for example, static colon colon function name, for example.


    Juliette Reinders Folmer 2:26

    Absolutely, yeah.


    Derick Rethans 2:27

    Which you can use with call_user_func by having two array elements. You can call it with literal syntax, but you can't assign it to a variable and then call it. Do I get that, right?


    Juliette Reinders Folmer 2:36

    Absolutely. That's it. There's eight of those. A

    PHP Internals News: Episode 100: Sealed Classes

    PHP Internals News: Episode 100: Sealed Classes

    PHP Internals News: Episode 100: Sealed Classes


    London, UK

    Thursday, March 24th 2022, 09:04 GMT



    In this episode of "PHP Internals News" I talk with Saif Eddin Gmati (Website, Twitter, GitHub) about the "Sealed Classes" RFC that he has proposed.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:14

    Hi, I'm Derick. Welcome to PHP internals news, the podcast dedicated to explaining the latest developments in the PHP language. This is episode 100. Today I'm talking with Saif Eddin Gmati about the sealed classes RFC that they're proposing. Saif, would you please introduce yourself?


    Saif Eddin Gmati 0:31

    Hello, my name is Saif Eddin Gmati. I work as a Senior programmer at Les-Tilleuls.coop. I'm an open source enthusiast and contributor.


    Derick Rethans 0:39

    Let's dive straight into this RFC. What is the problem that you're trying to solve with it?


    Saif Eddin Gmati 0:43

    Sealed classes just like enums and tagged unions allow developers to define their data models in a way where invalid state becomes less likely. It also eliminates the need to handle unknown subtypes for a specific model, as using sealed classes to define models gives us an idea on what child types would be available at run time. Sealing also provides us with a way for restricting inheritance or the use of a specific trait. For example, if we look at logger trait from the PSR log package that could be sealed to logger interface. This way, we ensure that every use of this trait is coming from a logger not from any other class.


    Derick Rethans 1:24

    I'm just reading through this RFC tomorrow, again, and something I didn't pick up on reading to it last time. It states that PHP already has sort of two sealed classes.


    Unknown Speaker 1:35

    Yes, the throwable class in PHP can only be implemented by extending either error or exception. The same applies for DateTime interface, which can only be implemented by extending DateTime class or DateTime Immutable class.


    Derick Rethans 1:52

    Because PHP itself doesn't allow you to implement either throwable or DateTimeInterface. I haven't quite realized that that these are also sealed classes really. What is sort of the motivation behind wanting to introduce sealed classes?


    Unknown Speaker 2:06

    The main motivation for this feature comes from Hack the programming language. Hack contains a lot of interesting type concepts that I think personally, PHP could benefit from and sealed classes is one of those concepts.


    Derick Rethans 2:18

    What kind of syntax are you proposing?


    Saif Eddin Gmati 2:21

    The syntax I'm proposing actually there is three syntax options for the RFC currently, but the main syntax is inspired by both Hack and Java. It's more similar to the syntax used in Java as Hack uses attributes. Personally, I have been I guess, using attributes from the start as I personally see sealing and finalizing similar as both effects how inheritance work for a specific class. Having sealed implemented as an attribute while final uses a keyword brings more inconsistency into the language which is why I have decided not to include attributes as a syntax option.


    Derick Rethans 2:56

    In my opinion, attributes shouldn't be used for any kind of syntax things. What they shoul

    PHP Internals News: Episode 99: Allow Null and False as Standalone Types

    PHP Internals News: Episode 99: Allow Null and False as Standalone Types

    PHP Internals News: Episode 99: Allow Null and False as Standalone Types


    London, UK

    Thursday, March 10th 2022, 09:04 GMT



    In this episode of "PHP Internals News" I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about the "Allow Null and False as Standalone Types" RFC that he has proposed.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:15

    Hi, I'm Derick. Welcome to PHP internals news, a podcast dedicated to explain the latest developments in the PHP language. This is episode 99. Today I'm talking with George Peter Banyard, about the Allow null and false at standalone types RFC that he's proposing. Hello, George Peter, would you please introduce yourself?


    George Peter Banyard 0:36

    Hello, my name is George Peter Banyard. I work on the PHP language, and I'm an Imperial student in maths in my free time.


    Derick Rethans 0:44

    Are you're trying to say you're a student in your free time or contribute to PHP in your free time?


    George Peter Banyard 0:49

    I feel like at this time, it's like, both are true at the same time.


    Derick Rethans 0:53

    Let's hop into this RFC. It is titled allow null and false as standalone types. What is the problem that it is trying to solve?


    George Peter Banyard 1:02

    This is the second iteration of this RFC. So the first one was to just allow null initially, and null is the unit type In type theory parlance of PHP, ie the type which only has one value. So null is a type and a value. And the main issue is that when for leads more with like inhabitants, and like the Liskov substitution principle. If you have like a method, like the parent method, which can be told like either null or an object, and your implementation in a child class always returns null, for various reasons, maybe because it doesn't support this feature, or whatever is out, or... If your child method only returns null, currently, you can't document, that you can't type this properly, you can document it in a doc comment or something like that. But due to how PHP type handling works, you need to specify at least like another type with null in the union. Basically resort to always saying like mimicking the parent signature, when you could be more specific. This was the main use case I initially went into.


    Derick Rethans 2:08

    If I understand correctly, you can't just have an inherited method that has hinted as to just return null?


    George Peter Banyard 2:14

    Exactly. If you always return null, maybe because you always work or something like that, then you must still declare the return type as like null or exception, which is not a concrete because you say what, like why never fail. And like static analysers, if they can figure it out that you're using a child class, they can't maybe like do some assumptions or work further down that like what you're doing is redundant or things like that. So that's one of the main reasons I initially went with it. And I didn't add false initially, because it was like, well, false, it's not really a type properly. It's, it's what's called a value type. False is one value from the Boolean type. And I was like, Well, okay, we're just going to limit it to like, being the type theory purist, limited to proper types, where null is a proper type, although it's a bit sometimes misunderstood, I feel in the PHP community at large. And then people were like, well, if

    PHP Internals News: Episode 98: Deprecating utf8_encode and utf8_decode

    PHP Internals News: Episode 98: Deprecating utf8_encode and utf8_decode

    PHP Internals News: Episode 98: Deprecating utf8_encode and utf8_decode


    London, UK

    Thursday, March 3rd 2022, 09:02 GMT



    In this episode of "PHP Internals News" I chat with Rowan Tommins (GitHub, Website, Twitter) about the "Deprecate and Remove utf8_encode and utf8_decode" RFC.

    The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news


    Transcript

    Derick Rethans 0:14

    Hi, I'm Derick. Welcome to PHP Internals News, a podcast dedicated to explaining the latest developments in the PHP language. This is episode 98. Today I'm talking with Rowan Tommins about the "Deprecate and remove UTF8_encode and UTF8_decode" RFC that he's proposing. Hi, Rowan, would you please introduce yourself?


    Rowan Tommins 0:38

    Hi, I'm Rowan Tommins. I'm a PHP software architect by day and try and contribute back to the community and have been hanging around in the internals mailing list for about 10 years and contributed to make the language better, where I can.


    Derick Rethans 0:57

    Excellent. Yeah, that's how I started out as well, many, many more years before that, to be honest. This RFC, what problem is this trying to solve?


    Rowan Tommins 1:08

    PHP has these two functions, utf8_encode and utf8_decode, which, in themselves, they're not broken. They do what they are designed to do. But they are very frequently misunderstood. Mostly because of their name. And because Character Encodings in general, are not very well understood. People use them wrong, and end up getting in all sorts of pickles that are worse than if the functions weren't there in first place.


    Derick Rethans 1:37

    What are you proposing with the RFC then?


    Rowan Tommins 1:39

    Fundamentally, I'm proposing to remove the functions. As of PHP 8.2, there will be a deprecation notice whenever you use them, and then in 9.0, they would be gone forever, and you wouldn't be able to use them by mistake, because they just wouldn't be there.


    Derick Rethans 1:56

    I reckon there's going to be a way to actually do what people originally intended to do with it at some point, right?


    Rowan Tommins 2:02

    So yeah, there are alternatives to these functions, which are much clearer in what you're doing, and much more flexible in what you can do with them so that they cover the cases that these functions sound like they're going to do, but don't actually do when you understand what they're really doing.


    Derick Rethans 2:20

    I think we'll get back to that a little bit later on. You're wanting to deprecate these functions. But what do these functions actually do?


    Rowan Tommins 2:27

    What they actually do is convert between a character encoding called Latin-1, ISO 8859-1, and UTF-8. So utf8_encode converts from Latin-1 into UTF-8, utf8_decode does the opposite. And that's all they do. Their names make it sound like they're some kind of fix all the UTF 8 things in my text. But they are actually just these one very specific conversion, which is occasionally useful, but not clear from their names.


    Derick Rethans 3:01

    It's certainly how I have seen it used in the past, where people just throw everything and the kitchen sink at it, and expecting it to be valid UTF 8, and then at the end, decode. I mean, the decoding was not even part much of this, right? It's just throw everything at it, and t

Customer Reviews

4.0 out of 5
1 Rating

1 Rating

Top Podcasts In Tecnologia

Tecnocast
Tecnoblog
Hipsters Ponto Tech
Alura
Giro do Loop
Loop Infinito
MacMagazine no Ar
MacMagazine.com.br
Área de Trabalho
Gigahertz
Data Hackers
Data Hackers