« first day (3447 days earlier)      last day (1484 days later) » 
01:00 - 14:0014:00 - 00:00

1:05 AM
@NikiC Roger. Thanks.
 
 
3 hours later…
4:16 AM
@Danack HE PASSED NIKITA?!?!?!?!
Imagine if he got as much work done as Nikita did too...
 
 
2 hours later…
6:17 AM
morning
\o
 
7:09 AM
@beberlei you're missing some colors on php-rfc-watch.beberlei.de see the sub vote for "Write-once properties" the question about keyword choose is missing colors and chart bar is invisible as well as option legend color boxes.
 
My guess is that it happens because I removed the "yes" and "no" options from the secondary vote (unfortunately, I started it with these options)
 
 
1 hour later…
8:31 AM
 
o/
 
8:53 AM
Support break for array_walk/array_walk_recursive ・ Scripting Engine problem ・ #79411
 
9:08 AM
Am i allowed to ask about regex here?
 
I'll allow it
 
If so, I am trying to match @asd in a string like this -> "hello @asd welcome" but I also want to match it if it is a word itself. So I am using \b but it looks like it does not want to work with '@'
 
did you try [@\b] instead?
 
My current pattern is /\b@asd\b/
Lemme try
/[@\b]@asd[@\b]/ like this?
 
Literally /[@\b]/
 
9:14 AM
no I misunderstood what you were doing. Are you attempting to extract that single word or separate the string into words?
 
im attempting to replace a single word
 
madainn mhath!
 
좋은 아침
 
i got it @ is a word boundry character thingy
for \b
guess theres no way of doing it
 
@Tiffany Mòran taing!
 
9:26 AM
@kahveciderin how familiar with regex are you?
 
You want to match @asd or asd ?
 
\B@asd\b guess this workd
s
@asd
@Tiffany not that much i used it for writing my own programming language and a couple of times to filter html text and for url parsing
 
Depending on how much you'll be working with it, you'll probably benefit from learning regex
 
@kahveciderin it works but it's hardly a regex, you could use a simple substring-match for that. What are you trying to do with the string that you match, replace it? Or extract it for usage elsewhere?
 
Or this @\basd\b ?
 
9:39 AM
it al depends - do you understand what \b is?
 
@MátéKocsis stop the sensible RFCs! You are making too much sense: this is PHP!
3
 
@Ocramius :'D :D we can always hope ^^
 
@MátéKocsis The var_dump() example looks wrong?
It's dumping a string
 
9:55 AM
good moanings
 
good morning all o/
 
Did my email to internals cause any stir? :-)
@MátéKocsis Want to chat for the podcast on floats, locales, and that new RFC?
 
@NikiC ops, you are right. fixing this
 
@Derick I think a couple of people also sent private STFU's off-list
 
@Derick I'd leave the opportunity for @Girgias if he agrees ^^
otherwise, we can talk
 
9:59 AM
@MarkR I did as well to him.
@MátéKocsis My auto-transcription tool had a lot less issues with transcribing your audio ;-)
 
Lol
 
It's quite funny, it struggles a lot more with native English speakers
 
I was reading a couple transcriptions, I think the audio for @MátéKocsis and I forget the other one
 
unfortunately, I struggle with native English (language) :'D
 
I did actually get an email from somebody asking to do an ep on the whole RFC process. I think that's a good idea too. Just need to find a person to do it with
 
10:02 AM
(also sorry for pinging you, I was using autocomplete to get your name right :S)
 
@MátéKocsis I disagree. You were very clear with good pronounciation.
@beberlei I just pinged you on work-slack and I've some PR reviews for you :-)
 
@Derick I'd vote Nikic if he's not too busy, otherwise someone else who's familiar with it, and can explain the process well
Maybe yourself, Derick? :D
 
@MátéKocsis Also SSCP -> SCCP ;)
 
@Tiffany It's hard to have a discussion with myself ;-)
And I've bugged @NikiC quite a lot already :-)
 
10:20 AM
sounds like a job for... panel discussion \o/
 
Editing two audio streams is hard enough :-þ
 
Do you use auto ducking?
 
Was that an auto-correct mistake?
 
Nope, auto duck(ing) might save you some time by automatically trimming the gain of other tracks while one track is speaking, to clean it up a bit so you don't have to manually slice it.
 
oh right.
 
10:47 AM
@Derick could you also change the intro music, so it fades in later and fades out later, so you get less drum and more synth. Thanks : )
 
@NikiC Thank you Nikita, for the corrections :) I found out why the var_dump() example is wrong: that section was a bit restructured and I wasn't sure about the behaviour of var_dump() + forgot to check it
 
@jjok Hehe. You like the music?
 
Yep. Except too much drum and not enough synth.
Did you you make it yourself?
 
I like it more now that I know it's called Chipper Doodle.
 
10:53 AM
Oh no, ignore my last message... it doesn't make any sense :)
 
I like that piano bit which comes in around 44 seconds
 
I can't just put the whole tune out in the feed though :-)
 
It's like I'm listening to the 12" dance remix of your podcast.
 
It's like watching John Oliver for a few years then realising his intro music is a full song - youtube.com/watch?v=oAPjTHA19Kw
 
it's quite a shit song though...
 
11:15 AM
@MarkR Oh nooo, I was convinced it's an intro specially made for John Oliver show :/
 
hi, i'm a newbie in php and would like to ask if the way i created an array object is good. it works well - i just would like to know if there is a shorter, better way to do it

here's the codesnippet: https://pastebin.com/dZWKsR8m
 
@brzuchal If John Oliver doesn't win allll the awards for fuck-you-bob it'll be a travesty.
 
:)
@qd0r it could be simply an array of arrays cause your objects doesn't have any behaviour nor restrictions regarding property types etc. about the naming you should definitely work over that the first class NavModel from what I can see is simply a Category and the second NavModelItem is just a CategoryItem or CategoriLink or CategoryEntry whatever you call it from you r snippet it looks like it doesn't exists separately
 
@brzuchal thank you. so instead of new NavModel() / new NavModelItem() it coult just do new Object() right?
 
no, you've misunderstood completely
 
11:29 AM
whoops
 
naming things like NavModel is almost as bad idea as puttgin class into Utils
Name properly, what is the first container for?
From your snippet it where NavModel has two properties $category and $items it looks like the intention was to be a Category in sort of Navigation so name it properly not a NavModel - cause what does it say? Model stands for nothing special
Nav - can be Navigation but these objects are not entire navigation only a piece of it which aggregates NavModelItems (we'll get back to that) so this is a thing with $category being a string and describing probably category name in website Navigation system
IMHO it should be named Category then cause the reader who would read the code later would read that almost like a prose
 
well basically i just wanted to make an array in an array to see how i can iterate it in a view and handle null objects. with the naming you are right. it's not a navigation
 
the next one NavModelItem - again Item of what Item of Model - no special meaning
 
i'm going to rename it :)
 
Item of Nav - ok going that path it looks from your code that it doesn't exists separately only as a part of Category also got an $url and $description which probably describes a Category Link?! - name things wisely so the reader doesn't have to think what you had in mind
YW
 
11:38 AM
it's a lot of code in PHP to fill a model, i thought it's easier ;)
 
about the behaviours - there are none, ofcourse you add an items into category but could if there are some rules for eg. Link|Item cannot be duplicate of already existing one then you should close your class and restrict direct manipulation of $items in Category through a dedicated method like $category->addLink(CategoryLink $link) which checks under the hood if the link already exists or through a method which creates an instance of a Link|Item
like class Category { public function addLink(string $url, string $description): void { $this->items[] = new CategoryLink($url, $description); }} etc.
@qd0r if you don't need any behaviour then forget about it do it simple if you don't care
 
that's a good idea. this way i can save a lot of lines of code
it's just a web project for myself to learn PHP. the page is a collection of code i write by following a tutorial.
so i prefer to make it more complicated and learn how it works
thank you very much!
 
11:59 AM
YW
Ok, so I can see Object-Initializer just got buried :( on a ML
 
12:11 PM
After thinking again I think I would vote "no" on ctor arguments promotion - combining it with annotations would be a mess, ctor has to be at the beginning of the class while currently I keep it after all named constructors which are implemented in form of static methods, also it would be a lot easier with OI caus ehten I could skip ctor completely which am already doing quite often for Commands, Queries, Events and DTO's
But on the other hand if I cannot get OI and skip ctors completely when need object in proper state all the time the next thing I could do are structs with initializer and with pass-by-value
 
cmb
@brzuchal that might be a good idea. :)
 
@cmb I think I got my analysis for structs somewhere on a drive, in these days with coronavirus maybe I'll find the time to finish them and would ask for proof-read this week here
 
cmb
yeah, sure :)
 
I think I'd prefer seeing a "Struct" thing, which is pretty much a immutable value object with public read-only properties
 
OMG I think I just figured out a syntax which might work and could be quite distinguising from object instantiation
@Derick if it's pass-by-value you can mutate it in function and it'll copy on passing over - so no need to keep immutability then, right?
 
12:22 PM
no, if you want modify it, create a new struct
 
@Derick I think the "value object" part doesn't hold true because they should have behaviour. so I'd rather say DTO-s
 
I need to refresh my memory and finish analysis and concept
 
DTO-s?
 
ah, I wanted to be too fast: Data Transfer Objects
 
data transfer objects
 
12:24 PM
yes!
 
Dangerously Tasty Octopus
 
what behaviour do they need?
Darkly Tainted Oysters
 
I think it would not be hard from parser perspective to differ struct declaration and struct instantiation if they both starts with struct StructName {... and $s = struct StructName {... right? does it make sense?
 
Derick Tastes Orangey
 
:)
 
12:25 PM
You don't know how I taste
 
like a fine single malt
 
DTO's doesn't have any behaviour
and they shouldn't
 
you can just overload new @brzuchal
 
for example a money value object should be able to add another sum of money to "itself" (immutably)
 
That's not a DTO
That's a VO
 
12:27 PM
yes, I think this is what Derick meant
or not?
 
DTO is more like a struct, it's just a container for a bunch of fields with specific format - types
 
that's the one I meant
 
and they're mostly small enought so you don't care about pass-by-value being an issue
Does it make sense to have struct declaration and instantiation look similar?
3 mins ago, by brzuchal
I think it would not be hard from parser perspective to differ struct declaration and struct instantiation if they both starts with struct StructName {... and $s = struct StructName {... right? does it make sense?
 
@brzuchal would structs support inheritance? is it possible at all?
 
12:29 PM
i'd advise against having the syntax be the same
keep structs simple
 
Ok
@MátéKocsis not struct don't follow inheritance
but they can use composition
 
aha, I see
 
something like in go could be an option you compose a struct from structs
but they 're two different types
 
I think I vaguely remember about something. by inlining themselves into each other, right?
 
yeah
 
12:33 PM
I think it's ok
 
<?php
struct Salary {
    int $salary = 1000, $insurance = 50, $allowance = 50;
}
struct Employee {
	string $firstName, $lastName;
	Salary $salary = Salary { 1200, 0, 0 };
	bool $fullTime = true;
}
function Employee(string $firstName, string $lastName, Salary $salary = Salary { 1200, 0, 0 }): Employee {
    return Employee {
        firstName = $firstName,
        lastName = $lastName,
        salary = $salary,
    };
}
$ross = Employee("Ross", "Bing");
that's the shortest example from my concept which I've started after OI failed 6months ago
It shows declaration and instantiation and also a way to create named initializer
 
I'm not very keen on structs though (somehow I have some antipathy against them ^^), but I also agree that it makes more sense to go in this direction with object initializers. and if many people like this concept than it's worth to discover this area
 
Many objects from my codebase now doesn't have any behaviour like all the commands, queries, events nor DTO's
Since we got typed properties in 7.4 most of them in my codebase even don't have ctor and if they do for some reason they only got an additional trait which adds magic __set which always throw - and in all properties are public
code is so nice and clean! I got rid of all getters and setters
classes are short for small objects sometimes the whole file even doesn't have 20 lines of code now
It's almost like a dream come true
the only missing part is initialization, which is still quite verbose
 
12:56 PM
@Derick yes, shorter by a half
one thing bothers me about the structs, if using a "struct" keyword should be ommited when instantiating struct then it should also be ommited on type hint, return type or property type - then it looks like a class name but is not instantiated like a class
 
THey should be a special type of class - just for the definition.
 
yeah, internally they would be cause then it simplifies a lookup
and the struct internally would be the same with some flag only
also writing an idea is in all a piece of cake, making implementation is different thing
 
nothing is ever as easy as it seems :D
 
...
 
?!
 
1:10 PM
@brzuchal Salary { 1200, 0, 0 } This is a bad example tbh, without knowing the struct property definition order by heart, you just cannot read that properly.
 
@bwoebi well yes, agree it's not much readable
the idea behind initialization without field names came because of position matters and won't change
but agree that maybe it's not a good idea
 
@brzuchal the idea is good and I support it … ust the example is a bad one :-)
 
I think it was here because it supposed to be a short way to initialize a default value of function argument and struct field value
I can work over that and remove positional initialization from the concept
 
@brzuchal I wouldn't remove it … there are other examples where it's much more obvious… e.g. Point { 2, 8 }
just for the specific example of the salary here it's not nice
 
In general it's a mix of small examples described separately but when combined into one this is how they present the feature
 
1:22 PM
@brzuchal I like that
 
@bwoebi great to hear that
@bwoebi what I'm afraid of is people start bike sheding about use of curly braces which the with "ctor" crane will start if they want' tu use them for named arguments
 
I don't like that
 
But just saying, the function body could be just reurn Employee { $salary, $firstName, $lastName }; … because there it is redundant
 
:P
imho it makes very little sense to introduce this as an orthogonal concept
And at least for these examples, doing the constructor promotion thing would be very similar in practice, while integrating very well into everything we already have
 
@NikiC is htere a way to improve it to make sense to you?
 
1:25 PM
Part of the core issue, I think, is that PHP has only class level visibility control, and thus "naked records" are tricky, because they can't be scoped to just a package/module, since we don't have those. So we have to be very careful about recreating raw structs/records.
 
@NikiC I was assuming these structs to be by-val though
but yeah, we can streamline that behavior into classes as well
 
Yes, the idea is to pass-by-value
 
Okay, this makes a bit more sense if this is about pass by value
But then again, why is that an orthogonal concept?
 
@Crell I didn't get it can you rephrase please?
 
I don't really know whether it makes sense to have this functionality in the first place, but if we do, I think I'd rather have something like a byval class. I.e. reuse everything we have, just with the addition of the by-val semantics.
 
1:28 PM
@NikiC the big problem is … at least in c# with classes and structs, that I'm often confused as to what is now passed by val and what not
 
@NikiC b ut we don't need ctor, methods nor visibility and wanna by-value semantics so it doesn't make sense to call them classes, right?
 
Go or Rust or Haskell have structs/records/product types that are "just" a couple of values glued together, with no wrapper on them. However, they can also be made package-visible-only, or even individual properties can be made package-only, which lets you avoid the extra overhead of protecting but not protecting things (beans) for internal use, while still offering a controlled API surface externall.
PHP/Java/etc put the access control at the class level, which I've seen good arguments is, 30 years on, not the right place for it.
 
@Crell But we're not talking about visibility concerns at all, why you mention that?
 
I'm coming into the middle of the conversation; I just woke up. I thought we were talking about structs.
 
Yes, structs, not package level visibility which can be discussed over structs, functions classes and everything else
 
1:32 PM
Calls for generics + cows... mooo
 
I may have misunderstood the context then.
 
@brzuchal I'd definitely want to have methods on by-val structs as well
 
Their nature is taht they're not a classes, they don't follow inheritabce, they don't restrict visibility cause they're all passed-by-value so why bother about visibility at all?
 
I don't think that by-value semantics have anything to do with any of those things
 
@NikiC and I'd definitely want an Object Initializer on classes over ctor-args promotion, but don't wanna argue and only find a compromise
 
1:33 PM
Because we would still want to have support for validation, which means at least sometimes you have to force changes through a method (whether implied with property accessors or not).
 
E.g. you might want to have a custom by-value array type (you know, just like normal arrays in PHP). However, those do not fit your narrow definition of structs at all.
 
@NikiC I think that it is cause when you pass it over you no longer care about that value if it's gonna change or not so you probably don't care about it fields visibility then, right? cause you're no longer an owner of the reference
 
/me has a whole presentation on why using free form associative arrays as anonymous structs is bad. :-)
"Make invalid states unrepresentable".
 
@NikiC isn't that generics supposed to handle that specific case?
@Crell agree on that, but please don't mix structs which are predictable cause of typed fields with arrays which are hashtable of anything
 
How would byval work in the absence of explicit types on variables?

foo(byval StructClass $x) {
$y = $x;
// is y now a completely different instance to X?
}
 
1:39 PM
@brzuchal We're agreeing on that point. :-) (The thrust of my talk and article is that using a naked class with just public properties is superior in every way to an anonymous struct-array, and you can evolve it into a full object with methods as the situation demands.)
 
@Crell Yes, agree sometimes it benefits, but on the other hand it's useless when you pass a DTO over from higher layer abstraction into the lower, cause after that goes out you don't care what happens with it. You're never gonna get it back for porcessing it's just a strict defined and named tuple with copies of values
 
I still don't know how we're disagreeing...
 
I hope we're not, maybe I don't unsderstand something but I really care about finding compromise cause hate investing my time into something which always goes down :(
 
@brzuchal That's my excuse for being single... that and my personality
 
@brzuchal The curse of "open source" right there. Have many T-shirts.
 
1:43 PM
I may not always grasp a hidden though cause am not a native English
 
@brzuchal garfieldtech.com/presentations/slides-never-use-arrays/… - And page down. That's the presentation I'm talking about.
 
@Crell the named struct you've got on a slide can lead to situation I wanted to avoid with struct initializer
there is no ctor so you're able to instantiate an object with uninitialized properties, with structs it could be mandatory to initialize all what has no default value
 
Sure. Which is where IMO the combination of named params and constructor promotion solves the same problem with code that looks almost the same, but offers benefits to many other cases, too.
 
IMHO it solves the problem but introduces another, meaning that it always has to be at the beggining of class definition and would be really hard to read if you put an annotations for properties, you can no longer group properties with the same type anymore and with a long list and additional ctor body it just introduces a mess and I fear about people overusing it
For those specific case like on a slide where all you require is a named type with a bunch of typed public properties, some of them with default values and easy way of inititialization, no inheritance needs and no need for extra final keyword - a struct IMO is a way better solution
Cause not only instantiation is simplified when you create an instance and pass it over you no longer care about it, you no longer hold a ref to it, you only pass a value with copies and that's it. you don't care about visibility restrictions at all
Please correct me if I'm wrong and have weak arguments then I can work over them
Maybe there's something more I didn't saw yet
 
1:59 PM
ctor promotion is also useful for service objects, for which you do not want public properties. You're injecting dependent service objects, and 99% of the time you do nothing with them but assign to internal properties. ctor promotion would handle that case equally well, and handle the value object case regardless of whether you want the properties public or private. a public-only initializer syntax does not.
 
I hate silence :(
 
01:00 - 14:0014:00 - 00:00

« first day (3447 days earlier)      last day (1484 days later) »