« first day (4125 days earlier)      last day (827 days later) » 
00:00 - 17:0017:00 - 00:00

12:11 AM
@Tiffany not at all believable - the biggest distinguishing feature between the alien overloads and real British humans is the overlords don't apologise (which is the main way we know they aren't British)
...and yes I meant "overload", the biggest threat to our society is specificity
 
@Spoody only if your problem domain dictates that is the case - e.g. in many contexts, it is reasonable to say that for Feb28 + 1 month is Mar31 - but also Mar28 is equally valid for other use cases
@Danack , he,
 
sigh
Why am I feeling so embarrassed about this ffing shitshow?
 
idk because it's really like the opposite of your fault :-P
 
JRL
because trump isn't over here to distract everyone anymore
 
12:25 AM
if anything you are a hero for building a thing that defines some rules :-P
 
JRL
for a while everyone could say "well at least it's not that guy"
 
@JRL BoJo isn't much better than Trump. I've learned that it's easier to assume that anything he says is a lie, until proven otherwise.
 
@JRL I feel like Derick can get away with more in that regard since he is known to be Dutch so ppl will be looking in that wrong country
 
Dè tha thu a’ feuchainn ri ràdh?
 
JRL
@Derick yeah. it's really fascinating, because there are things that happen in UK politics that would be career breaking news stories over here that are just like "yeah, that's how it works". but then there are things over here that are the same in reverse.
 
12:28 AM
We'll see how this coming week goes...
Is Sue's report coming out? How redacted will it be?
@JRL At least you've a written down constitution...
 
JRL
like one of the lines that will result in massive civil unrest over here is using the aparatus of government to structurally harm or benefit people. that's what happened several different times during trump. but when it comes to stuff like the covid party, people over here are just like "well yeah, shitty corrupt people will be shitty and corrupt. no point in removing them, the next person would do the same."
and it is nice that we wrote it down, that's definitely something i am thankful for
 
@Derick had to Google xlate it annoyingly :-P I'm saying that the ability to communicate effectively/coherently in a way that is alien to most people around you is kind of intimidating, I don't feel like that's unreasonable :-P x
I am not a million miles away from being able to read welsh to a passable level, but true gaelic dialects are still a long way away :-/
 
@DaveRandom I'm not surprised that you had to G translate that! Not many people even in Scotland speak enough gaelic...
Dw i'n dysgu cymraeg hefyd.
Duolingo baby.
 
no (I believe) but I think scots G is fairly similar to irish G, at least sylabically?
 
A little. The accents are the "wrong way" around.
Dw i eisiau cysgu nawr. Nos da.
 
12:38 AM
Gosh I want to commit murder, shit not working, ask lecturer if my use of parenthethis instead of braces is the issue, says the brackets I use is not the issue. One hour later being helped by other people
IT WAS THE FUCKING BRACKETS
 
it's the mad conditional digraph shit I don't get
Croeso i Gymru <-- like day 1 phrasing, but suddenly there's a G in there wtf
 
JRL
hey, i have a sort of... strawpoll question
for anyone here who wants to answer
 
"no"
ship it
 
JRL
what would you think about an error that is something like OptionalExit, basically for situations in which the engine cannot proceed, but where it's very likely the throwing code could be retried if the exception is caught
 
> the engine cannot proceed
to me that says E_ERROR
 
JRL
12:40 AM
right
this would be an E_ERROR where it's highly dependent on the data provided
for instance divide by zero
it's very possible that the program can continue afterward after such an error
OptionalExit would be something akin to "I can't continue if you insist on feeding me these variables"
"but you could maybe try different variables"
 
essentially you are talking about E_CATCHABLE_ERROR I think?
(which was/is bad imho)
 
JRL
something like that yeah
obviously they can already be caught
 
I mean... there is only one remaining in the engine which I have a PR to get rid of open for 2y
 
I feel like what you actually want is better error type segregation in core
 
And it's E_RECOVERABLE_ERROR
 
12:43 AM
^ that :-P
 
JRL
there's two reasons i think this is worth at least considering
 
it's worth noting that there are basically no circumstances I can think of where throw new \Error is not what you want
 
JRL
1. The actual problem isn't being changed at all, things of this nature are already recoverable errors whether the engine says so.
2. It provides a better error structure within core that can be extended and used by userland libraries
 
...so throw a RecoverableError or whatever?
the point of typed exceptions is exactly this, surely... the bigger issue is the number of programs which catch (\Throwable) at anything other than top level...
(my $0.02)
 
Every time I see \Throwable for anything short of handling closing a resource, I cry a little.
 
JRL
12:48 AM
yeah, all fair points from everyone, was just a thought i had this afternoon
 
youtube.com/watch?v=tNdBLBleO90 that came to mind. That's an oldie.
 
@MarkR I have a lot of reflection-consuming code that does it, because (when I wrote it, in 5/7 days) reflection is frustratingly unpredictable in both when and what type of things are thrown...
I assume that's still the case btw just trying to be generous :-P
also, to randomly bring this up again because it affected me lately - does anyone have any objection to adding (... , bool $autoload = true) for ReflectionClass::__construct()?
 
JRL
i still want to add ReflectionPath
 
1:04 AM
would bring it into line with [class|interface|trait|enum]_exists() and also provide an entity-type-agnostic way to query the symtable for existence, which afaik is not currently directly possible from userland
I have like 95% of an impl I wrote ages ago
 
JRL
for autoload in reflectionclass?
 
for autoload when ReflectionClass ctor with single arg is not an object instance
(so yeh)
basically, a flag to skip over the current logic for when supplied string arg is not a valid loaded class name
 
JRL
i want to have a way to ask the engine to reflect everything from a particular file or path
"just give me an array of all the defined structures in this file"
 
that's an ambiguous request
do you want the ones that existed in the file at parse time, or do you want it to be re-parsed?
 
JRL
hmmm
actually, im not sure
at parse time would probably be fine
 
1:10 AM
OK... but that's also not clear in PHP
 
JRL
the issue is that reflecting say, a class, from an arbitrary file is extremely messy
you have to already know the FQCN to reflect it
but you don't know that from an arbitrary file without something like regex
 
parse time might be ~0.005 secs after you entered main() in the target script, or it might be 3 hours later sleep(3600 * 3); include $path;
 
JRL
i mean, the file might also be unparsed at the time that the reflection is performed
 
imho it doesn't make sense to talk about reflection of PHP in terms of files, ditto any other scripting language
 
JRL
the idea is that this would let you reflect things that are not within the executing application
 
1:14 AM
OK, so what you want is a lexer/parser rather than a reflector I think
 
JRL
well, for my use case probably not
since what i would use it for is a documentation generator
and i would need to example docblock comments
which reflection mostly does, but a lexer wouldn't
well i guess it could
 
well a complete lexer should emit those tokens anyway
 
@JRL better-reflection library has this feature
 
JRL
yes, but better reflection also has to be updated with each new version of PHP
which is what i ran into
and is much more sensitive to changes to the engine than most libraries
 
sorry what are you trying to do? it's definitely not OK to do shit at runtime based on a per-run lex of local code??
unless you are making a debugging tool
 
JRL
1:18 AM
eh, this was something i ran into while i was building a documentation generator program which generates it directly from code
this is an example of the docs it generated: jordanrl.github.io/Fermat/roster/latest/Fermat%20Core/Numbers
 
urgh
I hate myself and everything about what I am about to say, but...
do not generate docs from code, generate semantic representations of your code decorated with comments
 
And the comments fell out of sync with the code and the world ended in a bang :p
 
XML is definitely the best tool for the job, and I don't hate docbook if it is used properly
/hides
 
JRL
yeah, i'll just pass on that suggestion personally
i get the point
but i see too much value in having documentation and code be maintained in sync
which requires an automated solution of some kind when you're not a big project
with lots of contributors
 
how does that works from a user PoV, when browsing docs can I select a VCS revision?
 
JRL
1:25 AM
yes, that's a feature i was planning on adding to the generator
actually, a way to automatically checkout every tag and generate unique docs for each was the plan
 
and do... what with those version-specific docs sorry?
:-P
 
JRL
provide a selector on the docs page that lets you swap the docs based on version
that's only super relevant to the source reference section of my particular docs
but if you would rather volunteer for my open source project to provide contributions so that docs can remain up to date, then sure, i'll stop using automation, lol
that's just the reality. i'm not a company that can pay for resources
it's what i did, or its nothing
 
that sounds really expensive internally - either docs live with code and repo will get huge v quick;y, or you need to maintain a separate repo for docs which means everyone has to have their local shit set up right and/or server hooks which will get real annoying in an emergency :-P
I don't have a better way btw just pointing out that you are gonna have to compromise somewhere at some point, have a plan for that :-)
 
If I really needed docs for a branch like rite now ... i'd build them then and there from what id checked out
 
^ ...or just read the comments in source that generated the docs
code docs are great, don't get me wrong, but unless you are working on jQ or something they probably aren't public facing...
 
1:59 AM
@Trowski / @kelunik what do you think about: github.com/neutomic/neu/blob/feat/database/example/users.php? ( SchemaManager/QueryBuilder are in progress ).
 
@SaifEddinGmati It looks nice … but well, from my experience, about 30% of the queries are going to touch multiple tables in a single select or update query - and that's typically when these query builds break down for me
 
@bwoebi can you give me an example? the convenience methods on DatabaseInterface should be simple, and i don't want to alter them, but i can take that into consideration for the QueryBuilder
 
basically most accesses where there's some related data … e.g. the name of someone who added an entry - i.e. joining the users table from the entry
 
ah, yea, that will be handled by the query builder ( join, inner/left/right .. etc )
 
It's fine if they're simple … but anyway, I'm probably the wrong person to ask, I typically avoid query builders and simple convenience methods like that. Just writing sql :-)
 
JRL
2:10 AM
i would use query builders if i believed they could make something remotely optimal with subqueries
 
I'm looking at doctrine dbal, laravel eloquent, cycle database and others to see what are the common features to include.
 
JRL
but that's why i don't use doctrine or anything like that either
 
@JRL the insert/delete/update/fetch methods should be optimal, i don't see how i can improve them more than this: github.com/neutomic/neu/blob/feat/database/src/Database/Bridge/…
 
it's a pretty nice feature of sql to be able to just c&p into your sql cmd and run it :-D
 
@bwoebi $db->insertAll($table, $rows)->getQuery() :p
 
JRL
2:14 AM
@SaifEddinGmati sorry, i was referring to subqueries. things like SELECT a.* FROM a WHERE a.col IN (SELECT b.col FROM b)
for a really simple example
 
@SaifEddinGmati … c&p from the source code :-P
 
@JRL ah, yea, didn't get there yet in my progress
 
obviously I can just dump it :-D
 
JRL
optimizing subqueries is probably NP-hard
so it's not that other libraries are bad
 
JRL
2:15 AM
it's just a thing i think you kind of have to do by hand
 
i tend to write a lot of SQL queries by hand as well when using doctrine, but i still use it as for most cases, the convenience of having a query builder overweight the maintenance work for such (mid-complex to simple) queries ( especially if you have juniors working on the same team )
 
 
8 hours later…
JRL
10:31 AM
@cmb it seems as if no one has opinions on PR#7973. not a single reply to my list email so far. i'll give it a few more days, but how do you think we should move forward if no one has opinions on it? hash it out here? in the PR?
 
Any idea which one is correct?
- Hope to not check google-search-terms as a verification item for recruit.
- Hope not to check google-search-terms as a verification item for recruit.
 
First one
 
thx
 
But it is still a clunky sentence
 
any suggestion for improvement? how would you say that?
 
10:46 AM
"for recruit." sounds odd?
What's the context?
 
context ^
 
Ah.

- We hope that an applicant does not check google search terms for verification

Maybe?
 
no, I want to say, "I hope the google HR team doesn't check applicant's search terms as a verification item to give them positive/negative score in the interview
 
11:00 AM
Ah, so... that alone is a much better sentence :-D
 
@Derick ah ok thx :D
 
 
1 hour later…
12:10 PM
Morning
 
 
 
2 hours later…
2:21 PM
o/
 
\o
 
mornign
I wanted to ask if it does make sense to revive the object initializer proposal now after named arguments and promoted properties are onboard.
The problem is not solved yet and new is any kind of inheritance over classes that already have promoted properties - what is struggling me is the need to extend the ctor in derivate as well as parent ctor call if there were promoted properties.
In languages like C# which have initializer support both can be used, a parameterless ctor and initializer, also AFAIK both are possible
This gives an option to extend classes like Commands, Queries, Events and ton of other DTO's which can now be implemented using public readonly properties easily and with promotion from ctor they're really nice immutable objects
But the problem comes if you need extend the type, then call to parent ctor is a must, also requires either keeping an eye on argument positions which is a horrible mistake if class has more than I'd say 5 props or constantly use named arguments when calling parent ctor - which brings another issue
First is quite hard to achieve, this is what named arguments solve - keeping the order
But the latter allows to pass values to arguments and that can be tracked, the problems here are two, IDE's like PhpStorm always suggest and highlight keeping an order of these to be sorted the same fashion they're declared, which happens on callee site - ofc anyone can disable that but if not then most of users probably would apply the suggestion by immediately increasing they're diff's
Another thing is tracking no of required args if parent args, which I believe such classes in general could to high degree live without any ctor at all
My idea for revival is to propose initializer block after ctor block (if such is ever required or drop of that part), execution after ctor (declared or default one) and stop calling parent in classes which are just dumb data containers.
Any idea if it does make sense now?
 
2:53 PM
An example where I could see use of it is this long class gist.github.com/brzuchal/32807178aafd80651f5378f9ca9b34ba
The parent class wouldn't need a ctor at all but it's nice to have a one-statement initialization feature for it
Unfortunately, this requires repeating all of the arguments and keeping them in sync in derivate.
The class which extends have more required arguments as it represents a real resource from another system, so the model is anemic (kind of DTO)
 
3:23 PM
Back when I was brainstorming about this kind of thing, I liked having brace-initializer syntax which didn't work if a constructor was defined:
$obj = Foo {
  id: $id,
  bar: $bar,
  baz: $baz,
};
Based on the features which have been added since then, it should could/should also support constructors which use constructor-property promotion.
 
@LeviMorrison wouldn't it be better to have some sort of an interface for objects that can be constructed using this syntax? something like BraceInitializationInterface with fromElements(array $elements): self method?
 
@LeviMorrison C# also allows combining the two. Although I think the primary issue is that most of the time right now, properties aren't public and only accessible through getters/setters.
 
@SaifEddinGmati This is an intersection of features I actively stay away from, but can you have static methods in an interface?
 
@LeviMorrison yes, it's possible afaik
 
@MarkR is that even worth mentioning at this point? We just added that error recently.
 
3:30 PM
@SaifEddinGmati Then maybe. I don't know about that. Constructor-less types and types with all properties set by constructor-promotion or something like that shouldn't have to deal specifying the interface.
 
@Crell Well it could be removed.
 
The main issue is the inconsistency between internal and userspace functions.
 
additional arguments should not error, it's a behavior relayed upon by many frameworks and libraries. mainly in Symfony
 
The question to ask, is this sensible
 
I agree. But as of now they do, for internal functions only. This annoys me greatly.
 
3:34 PM
Because by that logic we shouldn't be promoting undefined variables to errors
 
it's the only way to add arguments to a method on an interface without breaking BC
 
That's not what we are talking tho
We are saying passing more arguments than what a function signature declares
 
first you add @param tag without adding the arguments ( symfony adds the arguments but in a comment, such as /* string $foo = 'something' */ ), and in the next major, you remove the comment, and the argument is added.
 
This is an error for internal functions, not for userland functions
 
@SaifEddinGmati I disagree -- the behavior of internals is more sensible. If you want extra args, use variadics to make that explicit.
 
3:36 PM
@SaifEddinGmati Or you could just bump the version
 
i agree that the internal behavior is more strict, and I'm all in favor of that, but it's a behavior relayed upon by many people, and there is not alternative to it.
 
The alternative is to make them use variadics or wrappers to accept the extra args.
 
Symfony won't bump version to change an interface, because of it's release cycle, changing the last argument to be variadic is also a BC break ( for people implementing that interface )
@LeviMorrison when you type hint against an interface, you can't be sure that the wrapper instance will always be passed, and static analysis tools will start forbidden calling with extra arguments
 
I don't know the details of this "interface" you are talking about, but if Symfony uses this mis-feature, then they should change.
If they intentionally pass extra args to things, then they need to document that and require that the "things" are variadic.
The reason is simple: the moment you pass an internal function it will break. That's just a ticking time "bomb."
 
The most obvious example to me is something like a map method where map(fn($x) => ...) would be map(fn($x, $y) => ) with the $y (probably the key) omitted.
So can we add something to mark those arguments as omitted.
 
3:42 PM
For me it comes up mostly in cases where I'm dealing with an iterable, and passing values to a callback, and sometimes I want the key and sometimes I don't. Right now, that means I need two different operations (one that passes the key, one that doesn't), because internal functions will break if passing the key unexpectedly. User-space won't. Doubling the number of functions, well, sucks.
What Mark said. :-)
 
map(fn($x, ...) => whatever);
 
usually you find those in x.4 branch ( e.g: 5.4, 4.4, 3.4 ) as it's the last minor before the next major
 
@SaifEddinGmati it'd add more and more to really simple and dummy objects. My all transport objects do have public properties when it's important they're readonly but I don't think I should implement a class with props and then also mark it for engine to enable initializer
@LeviMorrison I assume this is a voice of interest to see such proposal, yes?
 
@brzuchal it's just an idea, personally would be okay with either ( i don't have voting rights but +1 from me :p )
 
@IluTov right now IMO is wrong assumption cuz depends on use I work with couple of integrations project and most of the codebase now are transport objects dummy ones no logic couple of required argument props is all they need and ability to extend them
 
3:48 PM
@brzuchal If it works roughly as I outlined, then yes ^_^. Simultaneously I'd like to see stdClass {foo: $foo} be the same as naked {foo: $foo}, but this requires duplicating some grammar rules and such so it's fine to leave that alone.
 
With CPP and RO properties now, I see no point in yet another constructor syntax anymore. Or in dedicated record types.
 
I think we need structural types which will be really powerful with additional constructors
 
Structural types?
 
Based on the property types / names rather than a particular name.
 
PHP is nominally typed, I really don't see how you'll get structural typing works
 
3:53 PM
@Crell agree, it is not really needed, but a syntax sugar for it would be nice ( i.e: struct User { string $username } is equal to final class User { public function __construct(public readonly string $username) {} } )
 
Eh, maybe, but it's then a lot of work to convert to the full object syntax if you want to have any of the bonus features of objects. (Methods, you decide you need a derived field, etc.)
 
I could see some degree of usability for something similar to a typed array, but this is also achievable through classes so
 
If you give me structs which are a new zval type which are CoW then now we're talking :-)
 
I'd rather have dedicated list and dict types first. :-)
(And a pipe operator that would work better for those than methods would.)
 
I think we only need a proper list type, and then array can be delegated to be the dict type
 
4:02 PM
@Crell same, but having those without generics is probably useless, there's no difference between them and arrays :(
@Girgias yea, untyped dict would be probably equal to array right now
 
Would it be at all feasible to hard-code generic functionality just for an internal list type?
Untyped dict would at least force you to set a key, rather than including the "auto-generate sometimes" logic.
 
Ah yes the Golang issue
Maybe?
Probably would need to force it a declaration maybe like $v = <T>[$v1, $v2];
 
Entirely speculating wildly here without any engine knowledge: If we added a new internal type "genericable", and then only internal types built on that supported generics, would that allow for, say:

$l = list<Foo>($val, $val, $val); $l . $l2.
 
if we allow function foo(list<string> $usernames): void, it's nice, but these generics are useless for every single function that operates on actual generic lists since you need function map<T>(list<T> $list, ...
 
list is already reserved tho
 
4:05 PM
Pick a keyword, don't care.
 
vec<T>
( vector )
 
@SaifEddinGmati Honestly even if it's just on the vec value itself that would be helpful. But maybe it would only be needed on the type hint?
 
bUt iT mAY NoT sATIsfY tHe vEcTOr sPaCE aXiOmS
 
(I realize this may or may not scope creep into genericized objects in the future. I don't know enough there.)
 
also, would a vec be coerced into an array when passed to a function that expects an array, or would it throw? 🤔
 
4:10 PM
I'd say throw.
 
and what about the opposite? and what if the array passed as a vec passes array_is_list? what if it doesn't?
if vec is passed to an array, would vec be considered a sub-type of array? if not, would iterable be vec|array|Traversable instead of array|Traversable? there's too many questions
personally i would say vec should be a sub type of array, so that array_* functions would work on vec, and we don't need new functions for dict&vec
 
The array functions are mostly crap anyway, IME, so I'd be perfectly happy to make them their own things. But they should be iterable, and spawn 0-based numeric keys on-demand when iterated.
 
namespaces functions for vec&dict 🤔
@Girgias you probably know more about this than me, is it possible to have function in core that are written in PHP ( maybe always preloaded/jit-ed? )?
 
@SaifEddinGmati Not that I know off, I mean you could maybe find the function name at runtime and try to cache it but that seems kinda bodged
 
I think technically yes, but there are technical blockers that prevent us from doing it to any serious extent. Nikita has explained it before, but I don't recall details.
 
4:22 PM
i think it would make it much easier for people to contribute stuff if we can reach a performance that is close enough from native ( e.g: for functions such as str_contains, array_is_list, .. etc ), those can be implemented in PHP
 
Agreed, but right now they wouldn't be. I already volunteered to help porting stdlib to userspace, but Nikita said it wouldn't work yet.
 
if it would become common to do so, i would probably open an RFC to merge PSL components one by one lol
 
Insert debate about putting code in stdlib vs Composer here...
Would someone with more engine knowledge than we peons weigh in on the "generics but only for new internal types" thing? Is that even worth discussing?
 
I don't know about just a dict, I think the ordered hashmap behaviour would need to remain and distinct list and dict / maps added
 
Well, current arrays will never be removed, ever, so they can still be the "mixed type ordered dict".
 
4:27 PM
@Crell as i said, the use case is really limited, for me, that's a -1, i think doing things the right way at the start is better than having a half-baked solution, yes, it's useful in some places, but for me personally, i would have to use vec<mixed> everywhere, because 90% of use cases are generic ( e.g: take vec<T> and return T, vec<T> or Something<T> )
 
But a dedicated dict type would allow is to rethink some of the behavior, maybe enforce a type, allow non-primitive keys, etc.
 
@MarkR what would be the difference between dict and map?
 
There wouldn't be one I'd think. I was following up to the comment that array can be delegated to dict. I'd think we'd leave array as is and build independent list and dict types, and dict would give no assurances about ordering, unlike array
 
@MarkR maybe in PHP 16 we can deprecate arrays :p
 
4:34 PM
@Crell How would you solve issues with the need to call and proxy most of the arguments to the parent ctor in cases like DTO where you wanna keep common things just common?
 
@brzuchal trigger warning screams
 
@brzuchal I'm not sure yet. CPP and inheritance do not lay nicely right now, that's true. But I feel like that can be solved without new syntax. (Eg, make the desugaring smarter.)
 
CPP won't solve the problem of repeating all the properties in derivates.
 
PHP Array Song: youtube.com/watch?v=qvpNa5O-0-8 Im a dict, a dict, a dict to you.
 
@MarkR Why? It's not something I can refactor trim the amount of fields, also it doesn't make sense to split cause it doubles the maintenance burden to keep in sync
The amount of fields is something I want to deal with the least efforts while still keeping the maximum of type safety
 
4:38 PM
@brzuchal No no, I get it, trying to extend a DTO that has a metric shit ton of named CPPs is hell on earth. I'm screaming from the thought of the pain.
 
Ah ok, thanks I misunderstood
 
Give me a structural-like type or something that could be initialized without having to use CPP and i'd be pleased.
 
@Crell Why not accepting already used solutions like proposed which already has acceptance in C# world then? Does that solve the problem? looks like, then why to overengineer things?
@MarkR I'd love that even more that could be similar to C# records
I was already thinking of adata keyword in front of class declaration which also changes semantics to pass-by-value
No need for readonly nor ctors then
all could be public typed some helper methods on it, that's it
 
hmm...

struct User {
string $username;
}

struct PasswordAuthenticatedUser extends User {
string $password;
}

$user = User { username: "foo" };
$authenticated = PasswordAuthenticatedUser {
username: "foo",
password: "bar"
};

$bar = $authenticated with { username: "bar" };

🤔
 
Structural like type - my first though was expressing the need for object with for eg. $foo property of type Foo, then gimme that.
 
4:43 PM
@brzuchal Because 1) I want to minimize the number of "Very similar but subtly different features that are hard to decide between". 2) Every time I try to think through record/struct types, I inevitably end up back at "it's exactly like a class but passes by value, so why not just put a by-val flag on classes?"
 
@SaifEddinGmati I'd go even further with placing the extends User; before or after some fields inside or even in the middle
this concept was in my mind for years now
 
Basically you want Go structs.
 
@brzuchal i think keeping the syntax close to classes is better, it's easier for people to adopt it
 
(To be clear, I love better and easier data modeling tools; if we could get PHP closer to F#'s capabilities for data modeling, that would be delightful. But we do need to keep those points in mind.)
 
4:46 PM
it's not about making syntax more complex, you don't need inheritance in structs rather composition of fields
 
Like... structs with pipes would actually go a long way to not needing methods on structs. :-)
 
@brzuchal that is confusing to me, seeing Person; i thought Employee has a $person property of type Person.
@Crell yea, i personally i would against having methods on such structs
 
Wait, maybe I was in hurry and linked wrong example then
 
@SaifEddinGmati There's guaranteed going to be a request for them. And... a good pipe operator would be the way to address that if you didn't want to give them methods.
 
Getting back to my question about the initialiser, then I heard it's too early that we need CPP need guards for sort of immutability, lot of complaints about that. Now we do have all these features, why not to complete the bucket of object initialisation.
But please with arguments
 
4:50 PM
@Crell i don't think pipes are "required" personally, functions work fine, pipes would be a nice addition but structure objects without methods are okay.
 
I'd love to hear opinion that it doesn't make sense because of something eitherway I don't know why and if I should put that on a shelve again
 
@SaifEddinGmati because(this_pattern(is_so(readable($struct)), isn't it))
 
@SaifEddinGmati it was good example, this is a composition of a struct with a fields/shape from another struct
 
@brzuchal As I said, my main two objections are the points i stated above.
 
personally i would be okay with `Foo { bar: something() }` syntax for initialization.

If we would add structs ( as i suggested above ), we can limit the syntax to be used only on structs, because in most cases you would only create data objects at runtime, other objects/services would injected via dependency injection ( e.g: template engine, database connection ), or at least initialized only once.
 
4:53 PM
If structs cannot have methods, and cannot have pipe-pseudo-methods, a lot of people will avoid them. Like, most value objects have a method somewhere. If there's any inter-property rules, you need somewhere to enforce them.
Like, PSR-7 Request or Uri objects wouldn't work, because there's nowhere to enforce inter-property relationships.
 
@Crell Ok, then I can find examples for the first which makes sense in uses with for eg. match of fn() statements since there they open use of classes which are composed with public and/or readonly properties but also do have required ones in ctor, since these statement constructions require the use of single expression
Does that fit in it?
 
I understood every individual word in that message but have on idea what you just said. :-)
 
my objections to the gist you linked:

- properties should end with ; no , ( this is what is used for declaration of properties, and in my opinion, we should stay consistent )
- creating a struct would be better using `struct { foo: bar }` instead of `struct { foo = bar }` syntax, but this is a nitpick
- extending structs would be better using `extends` keyword similar to what is used in interfaces and classes to make adoption easier, as the syntax you proposed is a bit confusing to me, and can be to others.
 
No no I'm trying to find arguments which might convince, just thinking out loud.
@Crell I wanted to say that good examples might be an argument in favour for eg. showing
 
@SaifEddinGmati Assuming the intent is Go-like structs, extends is incorrect as you can compose multiple other structs, not just extend one. And then the struct should also satisfy the implicit interface of everything it composes.
 
4:58 PM
interfaces can extends multiple other interfaces, just because its extends, it doesn't limit it to one.
 
struct Employee { Person; }

function printName(Person $p) { ... }

printName($employee); // works
 
unless we want to make struct fancy classes instead of a separate type, then reflections will have a problem.
@Crell it would work the same with extends
 
Oh god, reflection...
Hm, maybe. Interfaces are a valid point.
 
function foo ($type): Foo {
    return match ($type) {
        FooType::Person => new Person{
            name: "John Doe",
        },
        FooType::Employee => new Employee(/** list of required fields */){
            // initialiser of optional fields
        }
    };
}
 
00:00 - 17:0017:00 - 00:00

« first day (4125 days earlier)      last day (827 days later) »