« first day (4061 days earlier)      last day (1112 days later) » 
00:00 - 15:0015:00 - 00:00

00:00
@Danack I figured out where the memory leak comes from, I still need to write more tests for the function autoloading, but hopefully I'll have it done by the end of the year
@Crell I know Danack has an RFC draft, still need to flesh out the thing so
00:15
@Girgias cool. I'll look at the code, and update the RFC to reflect any changes...or ask questions about.
Sure :)
Also if you have any ideas for namespacing them, thinking \Autoload\Class\register() for the moment but yeah
@crell very draft is here - github.com/Danack/FunctionTypes/blob/master/… but does not reflect the code, or any of conversation I seem to recall having had with girgias about details.
e.g. splitting the calls by type, rather than a flag. so not so much:
autoload_register('classTypeAutoloader', AUTOLOAD_TYPE);
autoload_register('functionAutoloader', AUTOLOAD_FUNCTION);
and more:
autoload_register_class('classTypeAutoloader');
autoload_register_function('functionAutoloader');
But there is one section that needs to be written, and that's why in this code:
for($i=0; $i<10; $i++) {
    foo();
}
where foo is not defined before the code is run only triggers the autoload_register_function once, and not ten times.
Not sure if you seen this, but could maybe help you with naming and stuff: https://gist.github.com/azjezz/6d743c628624f2d1715c6cc3533c34ee

also, great work!
And you're not allowed to use any variant of "because otherwise it would be fucking insane".
@SaifEddinGmati You sent it me at one point, and I had a look, but I don't really see the thing with paths/maps as this can be implemented as a C function that you use as a standard autoloading function
Also on Thursday had a chat with @PatrickAllaert about autoloading a bit
00:23
@Girgias my feeling on namespaces is that PHP core shouldn't use them...
@Girgias yea, but thought autoloading would be slightly faster if PHP had a lookup table internally made up using the provided paths.
@Danack Which is fair, but autoload_*_(class|function|type|constant) looks pretty shit IMHO
@SaifEddinGmati I think Mark worked on this and the improvement was minimal
I was using a hash map at the start of the list rather than a function, it yielded about 6% performance in a pure autoloading loop. Pretty minimal, but I thought it may be worth it as a transparent optimization for a mechanism called hundreds of times per load
@Girgias depends on what you value possibly.
The issue with namespacing functions IMO is that it doesn't play well with most IDEs, which expect either fully qualified or fully imported. If you fully import you loose easy context, if you don't they end up effectively being just as long as if you'd done the function name in root
This is why my original namespace RFC sought to ban the use of namespaced functions + constants.
00:31
I mean the thing is I was thinking of 3 options, no namespace, which still has the issue of should it be autoload_(class|function)_utility() or autoload_utility(class|function)(), one level namespace which is just \Autoload\ but that doesn't resolve the order thing similar to the no namespace case, or 2 levels where then that issue doesn't arrise
@MarkR Yeah but that's crap, and only an issue because we don't have corresponding autoloaders
It was only partially to do with autoloaders, I find seeing random PartialNS\funcname less clear.
@MarkR I hate that honestly, wish ideas would add "import namespace" thing, though, if you manually import a namespace, PhpStorm for example wouldn't complain.
If you have Autoload\ClassLoader::register() it's still pretty obvious be it fully qualified or fully imported. If you have register() then who knows what it is (especially as you'll probably have another register right next to it for functions), so you end up with Classes\register() or Functions\register() both of which just feel a bit blurgh to me
The only downside I ever bought into for it was that you can't polyfill them
JRL
JRL
doesn't core technically reserve a namespace that isn't used for anything right now? i thought there was a reserved namespace for core.
Yes \PHP is reserved, but people couldn't agree on using it
JRL
JRL
00:36
sorry, that's not really related to the autoloading, it just reminded me of it
so the most obvious namespace to ever exist for core... is now deadzoned :P
JRL
JRL
i mean... we still could use it
we'd have to pass an RFC to undo the last RFC
It only talks about extensions
JRL
JRL
yeah, but you forget the kinda stuff i like working on, the hopeless cases, lol
00:39
@Girgias Yeah I think there were other problems, maybe there's a better approach.
@IluTov I think the main problem is if you do new type where type is not a class but the autoloader kicks in
If you store this within the class table that seems very messy
JRL
JRL
it seems like that would be a difficult/messy way to do things if DNF is passed, but i admittedly don't know much about the technical aspects
How I see a possible way is just that a type def/alias is a new zend_type, you need a special hashtable for autoloading but yeah, haven't thought much about it as there is some technical background needed prior IMHO
IMO the bigger question is where do they get defined... if it's file scope we'll need yet another autoloader
Well yes
That's literally why I'm working on a new autoloading system
Which is what I'm referring to why "some technical background needed"
00:56
Do you intend to cover constants as well?
@IluTov yeah; thus, no. I'll rather persuade my current employer into allowing us to work part-time on php-src...
@IluTov it was added, yes
@MarkR Probably, really doesn't seem to be complicated
@IluTov heap.space always works :-)
Anyone knows how I can convert an array callable to an object callable in C land?
@Girgias I guess you'll have to copy zend_create_closure_from_callable()
01:00
bleh
I really don't get why that case leaks memory
for reasons this is not ZEND_APIā€¦
And how with the SPL autoload implementation it doesn't
I mean I already have the FCI/FCC
@Girgias show me the code?
Don't we have a function that swaps values with keys? im looking at the docs but drawing a blank (nm saw it as soon as i hit enter - array_flip)
01:04
Like it only leaks if (Z_TYPE(entry->fci.function_name) == IS_ARRAY)
So I don't know if it's in how I release it or not, as otherwise it works
@Girgias there's something obviously wrong - you object_release entry->closure - which is only assigned if object. but given that you already Z_TRY_ADDREF fci.function_name, you're doing an addref too much somewhere else
@bwoebi Right, okay well time for more thinking then
@Girgias I recommend a watchpoint and observing rc change
@bwoebi Well no idea how to do this, but OK that sounds like a good idea
01:19
@Girgias want me to show it to you?
@bwoebi Would greatly appreciate it. :-)
@Girgias do you have some more private channel than r11?
@bwoebi I've got Discord: Girgias#1764, could do Microsoft Teams otherwise
@Girgias great, I don't have either :-D ā€¦ twatter dms?
@bwoebi That works :D
02:13
I think that's enough work for today. Goodnight all o7
 
1 hour later…
03:18
...
Dan vs SO chat formatting
03:33
Wes
Wes
\o
dan i'll look at your answer on github today. it's been awhile i know. image magick is a black hole of options and flags and functionality. mastering it would be cool
but then again we only have one lifetime. that would require a couple or something
That's putting it mildly.....
Wes
Wes
lol
I think although there are workarounds for what you're seeing, it's just nuts that it behaves like that.
But it won't change before ImageMagick 8, which is probably at least 5 years off......hopefully I can make the people who maintain it make some better decisions for that version.
unrelated - people really shouldn't be running New World - it sounds full of backdoors: youtube.com/watch?v=_DWBtUqOXo0
and on that bombshell, nn.
Wes
Wes
\o gn
 
2 hours later…
05:40
So I'm looking at the code base of my soon-to-be new employer, and I've realized I don't have a decent understanding of dependency injection containers. I'd like to play around with one in a toy project tomorrow, can anyone offer suggestions of exercises I could try?
I've worked with them before but they're still a bit magic in their operation for me.
Are you familiar with the term autowiring?
A DI container contains a list of either existing class instances, or information on how to build one. When you ask it for a service (class) it will look at the argument types in the constructor of that class, and try to match them up with classes it knows about. It will then create a new instance of that class, automatically passing it the constructor arguments from its internal store, this is called autowiring.

It's recursive, sometimes one of the constructor arguments will be a class which itself needs to be created using other services from the container.
That doesn't really answer my question
Knowing that, you can then try writing your own using reflection.
05:51
Not looking for an explanation of what they are, but something I could work through to become more familiar. Like an idea that I could run with.
The mechanism to get an object is defined by PSR11 but all the configuration beyond that is implementation specific.
Okay...
So you would need to look at something specific to your soon-to-be new employer's framework of choice.
 
1 hour later…
JRL
JRL
07:03
is zend_throw_error() an old way of creating an error?
07:26
No, it's the way to throw an Error exception
JRL
JRL
im not sure what i did, but my build is broken because apparently zend_API.h doesn't include the header that defines the instanceof_function function?
also, thanks @JoeWatkins
ah okay
thats odd, it's in zend_operators.h which is included on line 27, order issue maybe?
JRL
JRL
i included zend_enum.h in zend_operators.h
but zend_enum.h obviously requires zend_API.h first
okay, i could use some ideas if anyone feels like voicing an opinion. something i know people here basically never have...
i don't see a way to allow the ordering enum for comparison functions so that they can intelligently handle uncomparable cases without changing the return type of most comparison functions
some can be left int returns since they will under no circumstances produce an uncomparable result
however, the zend_object compare handler does need to do this.
I can pretty transparently, without any noticeable change, update the many, many spots in the engine
however, changing the object compare handler would mean that all extensions which create objects with comparison functions of their own would break. that seems like too large of a BC break for the benefit to me.
so if anyone has an idea or opinion on how to accomplish both, that would be grand
07:42
is that a common thing? extensions defining comparison functions
JRL
JRL
the only one i know for sure is ext-decimal and ext-date
the date one is bundled, so i can do that one too
ext-decimal is not bundled
maintained by the same dev that created ext-ds
how do they currently indicate something can't be compared using the int return?
JRL
JRL
by marking it as greater than and returning 1
which.... kind of works if you only use less than comparisons in the engine
which incidentally is what PHP does
all user comparisons got reduced down to either of these: comparison < 0 or comparison <= 0
so returning 1 for both orderings means that it would always be false no matter what order the operands were in
and using that same mechanism, doing the test twice for each one, would be hugely wasteful as a means of detecting uncomparable.... or is that how it's done?
it feels like zend_object_compare_t should have had a zend_bool* thrown in there for marking it as valid or not. But quite a big BC break
JRL
JRL
i already have to change the signature of zend_object_compare_t for this
to change the return type
07:52
what will it become?
JRL
JRL
zend_object*
which will in actuality be an enum case from zend_enum
Morning. What is the best way to implement web sockets with php? How does the lifecycle works for the language where events don't exist and scope it bound to request/response cycle?
@Leri amphp/websocket
Then run it from the command line, not via CGI
Hmm, interesting.
Thanks
JRL
JRL
@MarkR I don't think it actually runs the comparisons twice in most situations, because an uncomparable value shouldn't error, it just returns false for all comparisons: ==, >, >=, <, <=. So reordering operands to always use comparison < 0 and then forcing return value to always be 1 will always return false.
there might be a few situations where it runs it twice
particularly with objects? im not 100% on that, because some of that magic is in the compiler in places that look like black magic
08:05
got a public branch ?
what would the future behaviour be if an incomparable was encountered in say, a sort function? exception?
JRL
JRL
yes
okay, gonna share ? :D
JRL
JRL
@JoeWatkins are you asking me?
JRL
JRL
08:07
it doesn't build yet, implementation isn't finished
that might be another means of communicating it then from internal extensions?
JRL
JRL
@MarkR there's another macro, ZEND_NORMALIZE_BOOL, that takes a long or double and returns -1, 1, 0 that is even more problematic in some ways
because it's how PHP marks NAN uncomparable with ints and floats
is subtracts NAN from the compared number, which overflows and results in it always being positive, then normalizes to 1
so it always returns 1, which in the current code means always false
can you rebase on current master, I can't be bothered to fuck around with git
I was thinking that if you're going to throw anyway, checking EG(exception) after each one might be viable, it would seem to depend on if there's cases where an invalid comparitor would still continue to loop.
JRL
JRL
@JoeWatkins this is master from 3 days ago that's is based on
i can pull and merge master in again if something significant has changed?
08:12
which is perhaps likely if multiple functions can be called to compare each one
JRL
JRL
right, but then the comparison actually needs to return the ENUM itself to the user from the comparison if its assigned
I was going through the docs and can't seem to find Url/Uri class. Has not it been introduced yet?
@Leri amp has a huge collection of libraries, many interconnected, check the composer.json to see what links to what
why does zend_enum.h include zend_API.h ?
JRL
JRL
so we'd want (bool)Ordering::Uncomparable == false but $var = (stdClass < DateTime) === Ordering::Uncomparable
08:14
@MarkR I meant at the language level. I know there are few hundred of custom url implementions out there :)
JRL
JRL
@JoeWatkins I was prototyping, that's not intended for the actual PR to php-src
@JRL Ah I see, when I asked if it would result in an exception, I assumed that (stdclass < datetime) would throw rather than return an enum
I just found my old implementation of it and was wondering if it's worth investing time to port it to the new version and make a PR: github.com/leri/php-src/commit/…
JRL
JRL
@MarkR Currently that throws a notice and treats it sort of a hodgepodge of ways as far as > or <
@JRL ok I don't quite grok what's going on then, you can't include API there whatever (and don't seem to need it) ... I'm also confused about the zend_object* return from compare_func_t, that seems wrong
JRL
JRL
08:20
@JoeWatkins the change in return value is part of what im working on, but yeah, the zend_API.h include is not needed and i did resolve the build issue i was having as far as that goes :)
that's quite widely used
@JRL find a different way ;)
JRL
JRL
yes, it's a lot of dirty work to change comparison over to an enum
oh god no
that can't happen
I'm a bit confused by your intention now. So inequalities would no longer return booleans?
JRL
JRL
well no, <=> would return an enum, comparisons would return a boolean still
<=> would return the result case
and all sort functions would be changed so that their comparison function can provide either int or the ordering enum
08:22
$var = (stdClass < DateTime) === Ordering::Uncomparable
This confused me
JRL
JRL
the zend_object_compare_t would be changed to return the enum case
ah, yeah that was me giving a bad example that absolutely shouldnt be how it works, lol. focusing on too many things.
you're right, the normal comparisons would be boolean in all circumstances, yes
the operator handlers would translate the enum internally at the last moment to zend_bool
I don't have the whole story, but you can't change object handler ABI before 9, it has to be stable for whole major versions
and you can't tie compare_func_t to the implementation details of enums, that must not change ...
@JRL Would not it be wiser to do type check first and then perform an action? Also it would lead to less bugs if stdClass < DateTime triggered a warning or notice, is not it?
JRL
JRL
@JoeWatkins how would you propose improving the handling of the uncomparable return value from compare_func_t?
the traditional PHP way would be abusing the fuck out of globals :P
JRL
JRL
08:28
what we have right now is this code:

// TODO: Use a different value to allow an actual distinction here.
#define ZEND_UNCOMPARABLE 1
this is unfortunately more of a problem with core than it is in userland
and ordering enum for userland would be nice if it worked with the sort functions and such
can you tell me what the goal is, I'm sure you've discussed it in here, but I have no idea what the problem you're trying to solve is
JRL
JRL
which could be done without all this
@JoeWatkins The current implementation of ZEND_UNCOMPARABLE makes it absolutely impossible to create an opcode for IS_LARGER and IS_LARGER_OR_EQUAL. this is necessary for any operation which must distinguish between the order of the operands.
I have the operator overload RFC I'm working on and it cannot function correctly unless you know which object had precedence for handling the operator
which would be left to right.
but this also is important for certain domains
right now, writing an extension for matrix math for instance would be virtually impossible without a lot of hacks because of how these operators work
@JRL Just a thought why not just implement comparers? I.e. have the function that takes in two elements and returns subtraction value or throw an error if incomparable items are passed in?
JRL
JRL
@Leri that's already what we have in many places in core :)
Yup, I may be missing a larger picture here but as of now it seems like reinventing a wheel. :)
JRL
JRL
08:35
but subtraction is not commutative
@Leri consider something like new Decimal(3.0) > new Fraction('1/2')
what im doing in operator overloads is making it so you can write methods on these classes to tell it how to behave in that circumstance
but 3 <=> 0.5 is different from 0.5 <=> 3
what PHP does internally is it would take the operation and reorder it to new Fraction('1/2') < new Decimal(3.0)
so now suppose that these two classes have competing implementations of comparison functions. the PHP developer would expect the implementation of Decimal to be executed, since it is the left-most operand in the code they wrote.
But in fact, the comparison method on Fraction would be called instead, because oyu used a greater than comparison, and PHP reduces all user code to less than comparisons instead.
okay, full disclosure, I dislike the idea of users being able to overload operators and will vote against any implementation
JRL
JRL
yes, i believe you mentioned so back in august when i started working on it :)
im expecting about 400 hours of work for a rejection personally
sounds like the last person i dated.
but if you had a gun to my head and told me to do it anyway, I might go about it differently ... the root problem is that order of operands is lost by runtime, so, all of the compare opcodes have space in extended_value that you could use to store information about the order before it is lost
you might only need to change compare_function and compare_objects handler, it looks like, at a two minute glance ....
JRL
JRL
so you wouldn't make an opcode to separate > and >=, you'd have all inequalities store special ordering information in... the zval? where is extended_value?
08:43
opline->extended_value
@JRL I wouldn't ... but more than that, you can't get yourself into a position where zend_hash_compare relies on the details of enums, that doesn't make sense
JRL
JRL
ah, > and >= don't call compare_function
or not at first i dont think
yeah
they call is_smaller_function and is_smaller_or_equal_function
the order has already been reversed by that point
it happens during compile im pretty sure
for the object case, they call compare function
same in 8.1
JRL
JRL
pretty sure they're already reverse at this point as well, unless the opline already stores something about the difference between the two
@JRL yes, but at some point during compilation, you know the order, so store it (new AST structure if you can't find anywhere to do it) and compile it to some meaningful value in opline
JRL
JRL
hmmm
I will take a look at that then. I personally would prefer to find a better way of representing the information itself internally and separate the opcodes, but I understand the argument for kind of... hacking it. Your point about making core code depend on the enum implementation is a good one though, so even doing it the way I'd prefer, something that doesn't create that dependency.
08:57
the one problem you want to solve is big enough - that's specifically user overloads - don't stray from that and don't add problems to the list ... you need to do this without interfering with the way comparators work internally, that's a separate problem with separate concerns
JRL
JRL
the ordering enum is a separate RFC actually, with the core feature of providing users the ordering enum and allowing them to provide one of the cases to the various sort functions in place of ints
which doesn't actually need to touch the comparison methods
since a late translation can be done in the sorts
it does need a better value for ZEND_UNCOMPARABLE though than 1
09:35
@JRL Which is absolutely fine. If you have compare function fn(Decimal $d, Fraction $f) => $d - $f will be fired when Decimal > Fraction is invoked and the function fn(Fraction $f, Decimal $d) => $f - $d when Fraction > Decimal. I.e. left operand means comparison function left argument, right operand right one. The only problem that may arise is ambiguity however, that can be handled in a different way
JRL
JRL
@Leri no it's... you're misunderstanding what's happening
I guess so. Anyways.. sad to say but for my liking php still lacks lots of things. :/ Sorry to bother you guys.
JRL
JRL
no, it's not a problem, im just not sure how to explain what the issue is with the engine. you're thinking about it purely from a user point of view in your examples. i'm just not sure how to explain it correctly.
09:53
@JRL I got what you are trying to solve. My question was why do we need to expose it to the userland? I am probably missing important piece of internal working however, as of now I am speaking purely from clean API standpoint
JRL
JRL
@Leri Ah, I see. Well I have like a 10,000 word RFC explaining my arguments for that, but that question is one that I have to convince people about in order to pass the RFC
@JRL That's actually good one. I would say few points are missing, e.g. if you overload __equals you must force to overload __notEquals, etc. you get my point. However, I was always against having magic functions so introducing interfaces like Equatable, Comparable, etc. would solve that problem. Later on if you do $comparableObject > $otherObject would ideally translate to $comparableObject->compareTo($otherObject) > 0;
if $comparableObject is null or instance of object which does not implement Comparable interface should throw an exception.
JRL
JRL
there are several problems with using interfaces that have been discussed extensively in the mailing list, but it is likely to produce much worse code in userland for a few reasons.
there is no __notequals() overload
$obj == $val gets turned into $obj->__equals($val, true) while $obj != $val gets turned into !($obj->__equals($val))
Okay, makes sense regarding notequals, but how is interface any different from magic function? I mean in terms of userland code?
JRL
JRL
this ensures that negating an equality comparison doesn't result in totally different logic being executed
From the RFC:

"While interfaces make sense for certain applications, in this case no interfaces will be provided. The magic methods work as hooks for engine behavior, and the interfaces would not be able to be properly typed outside of something like the Never For Parameter Types RFC.

More importantly, the interface wouldn't convey something meaningful. For example, a Matrix and a Money class could both implement a Multiplyable interface, but they wouldn't necessarily be able to multiply each other. Therefore, it makes more sense for such interfaces to be part of userland libraries and st
basically, the interfaces imply that a class would work with the operator in any context, however that isn't necessarily the case
what would multiplying a dollar amount by a temperature amount mean exactly if both implemented the multipliable interface?
10:08
@JRL Why not just let the implementation handle that? i.e. if (!($other instanceof Decimal)) throw new UnsupportedComparison ?\
JRL
JRL
@Leri then what value would the interface provide exactly?
compareTo($other): int and on top of that throws exception if comparison is unsupported
JRL
JRL
@Leri that is the signature of the method already?
Wes
Wes
of course ffmpeg can't convert decimal to sexagesimal properly
JRL
JRL
internals can restrict the signature of a magic method wihtout providing an interface
10:11
interface Comparable { function compareTo($other): int; }
JRL
JRL
right, but what value does that provide
the function signature is already enforced
@JRL Yup, that's actually a problem in my opinion. If we think in OOP what if the object in a state when it cannot be compared? Temperature is a good example, let's say you are trying to compare to a temperature which is below absolute zero (ideally, you should throw an exception at this point).
JRL
JRL
that's why im writing a way for PHP devs to control that
 
1 hour later…
11:21
@bwoebi If your employer lets you that's even better :) You know a ton about core so it would be a shame if you couldn't work on it.
11:41
This is what I came up within 2 minutes.
JRL
JRL
no i get how it works, im asking what is the benefit to having the interface over not having the interface
Which is pretty clean but obviously can be made even cleaner by passing concrete comparer providers
JRL
JRL
and just having the functions
@JRL You can simply use if ($obj instanceof Comparable) { // do stuff }
JRL
JRL
no you can't
because it's not guaranteed to be comparable
11:43
While with magic functions you have to dig in if magic function is defined or not
JRL
JRL
oh
so a few things
first, in PHP 8.1 object casting for comparisons were drastically reduced
many of them simply error now by default under many types of comparisons
perhaps that was 8.0 actually
but in any case, in the version this feature is targeting, people already cannot use operators in many situations
second, which is again detailed in the extremely thorough RFC that i linked, if you don't implement the magic method, the engine silently falls back to the built in comparisons that do exist
so there are no situations where the comparable interface will give you additional information
any additional information would require you to look at the implementation if any
the RFC im writing checks for the method on the left operand. if it's missing, it checks for the method on the right operand. and finally, if neither exists it passes the comparison back to the engines existing suite of comparison functions built into core.
this makes the BC break of the RFC nearly zero
Hmm, I see. that's kinda messed up though. :| In an ideal world I would be able to do function sort(CollectionOfComparables $comparablesArray). I guess that would be impossible based on current implementation
JRL
JRL
for operators that objects no longer work with, such as class + int, the previous error throwable is replaced by the new more specific error throwable InvalidOperator
sorry, i was talking about all operators not just comparisons since the RFC deals with much more than the comparison operators
the comparisons ones don't error now except in specific situations, very specific
however they always return false under many circumstances
since objects can't be sensibly compared in a lot of situations
8.0 the math operators were changed to errors instead of casts, not the comparison operators
Hmm, why cannot we introduce cast if object implements specific interface? e.g. Convertible?
JRL
JRL
cast for what?
11:58
Also Comparable interface rather than compareTo method have getHashCode which would represent the object in int
@JRL interface Convertible { function toInteger(): int; function toBoolean(): bool;... }
JRL
JRL
oh well, if you want to tackle trying to get people to vote for that be my guest, lol
i would personally like to see some ways to control object casting
but one impossible project at a time
overloads first
Well, more I look into the php as of now I am getting more and more disappointed to be honest. I have quite large pretty descent framework with routing, DI, ORM, etc. but probably I will just rewrite it into some other language... The language is clearly falling behind and that's sad as php is my first language.
JRL
JRL
errr, okay
well best of luck
Thanks, you too. I will still come by from time to time. :)
JRL
JRL
try haskell
12:33
@JRL the problem is not only that you have to convince people to get to accept operator overloading, but also to agree on the specifics. I do think operator overloading is viable - with the right semantics. Nomially, for example the lack of fallback to the right-hand operator if the signature of the left-hand does not allow for the operator is a hard no. It completely blocks extensibility.
Similarly I'm still not happy with the choice of __add() vs operator +(). The latter syntax opens us for a future scope of arbitrary operators, while the former rather blocks it or makes it hard to consistently fit in.
JRL
JRL
you're talking about if the left operator throws an exception?
if the left operator is unimplemented, it falls back to the right operator
if the left operator throws an exception, it doesn't fall back
@JRL the typeerror case, yes.
JRL
JRL
ohhh
yes
i'm not set on that btw
i considered both ways of doing it
i think the way i laid it out is better, but i'm not certain, and i don't think it's much better
to be perfectly honest, there are two reasons i went for the name methods instead of symbol methods: 1. implementing the symbol methods would have required a level of knowledge and capability in the compiler and with the AST i simply don't have and likely can't attain in time for 8.2 and; 2. the named method is likely to be less confusing and feel more like it fits in to the rest of the language to developers.
well i suppose it there was a third reason as well
3. i feel fairly certain that while there are people such as yourself that would see the benefit to doing the sybols, the changes to function name parsing restrictions, the compiler, and all the associated things would be seen by many voters as unnecessary for the feature and simply "too big"
it's something i would only be comfortable doing if someone was actually helping me with the implementation, and they understood the parts im not confident with, and they helped me advocate for it
@JRL Unless we fix/normalize the implicit casting your mission will be very hard. Why won't we take from there?
JRL
JRL
12:54
@Leri no casting is necessary at all if you get to directly define the logic for interaction with the operators
except for controlling explicit casts to scalars, or implicit casts to bool
which only occurs if you do one of (int)$class or if ($class)
i still think it can be useful to control casting, as i said its on my list of features to work on
along with type aliases and operator overloads
operator overloads has the highest impact of them in my personal opinion. the other two features have alternative ways to be done, but there are some behaviors and programs that are very, very difficult to do in a consistent and useable way without operator overloads
if the RFC as i've written it were to pass for instance, PHP devs could fully implement scalar objects. the only thing holding them back would be that the native types returned by other functions don't come pre-loaded in your scalar object.
@JRL the changes to compiler/parser are pretty minimal, at least compared to the rest of the RFC.
Let me strongly doubt that the code overhead is meaningful enough to sway voters in any direction here. I'm not going to accept that as a valid consideration.
@JRL the only "valid" consideration is "2. the named method is likely to be less confusing and feel more like it fits in to the rest of the language to developers". And here I disagree, especially considering things like future scope and well-roundedness.
13:44
@JRL let's suppose you could just ask someone to do the parser and compiler changes for you. Are there still hard blockers for you to consider operator +() syntax?
JRL
JRL
no. i imagine that the change is small-ish if you know what to change, i just don't. i've stayed away from the compiler mostly.
i also welcome the input and contributions of others on this. i am more interested in making a better feature than it being my little fiefdom or something
and to that end, as i said with the typerror point, i have my own opinions but i plan to take suggestions or opinions of others seriously
except for perhaps the opinion of "no operator overloads because no operator overloads"
which is a position i respect but do not share and don't intend to entertain. the voters will decide that one.
oh you know what, i totally missed that oyu wanted to keyword it with operator instead of function.
that seems like it would generate significantly less pushback to me
@Tiffany ...it's Sunday. And Auryn maybe.
@JoeWatkins may I offer you some cognitive dissonance - james-iry.blogspot.com/2009/03/…
Wes
Wes
boi code coverage is so slow in phpstorm now
JRL
JRL
14:04
@bwoebi a few caveats to the parser stuff: 1. obviously need to be able to get the function handler off the class_entry, and it probably needs to be a function handler. 2. the operator keyword probably needs to throw a compile error if it's used outside of a class definition. 3. what solution do you think would be appropriate for __equals and __compareto? == and <=>?
@JRL I would still have it implemented as a function so that $foo->"+"($bar, true) will still work, similarly method_exists and everything. Regarding 2 and 3: yes.
JRL
JRL
for those two it might be less obvious than the others that they are utilized for multiple operators (!=, >, >=, <, <=), so probably a strategy to mitigate that as far as documentation
14:25
@JRL While it might be unnecessary it would open room for lots of things so custom casting would be very useful for different purposes. If I get enough motivation, I may give it a try
@bwoebi The only possible issue I see there is lexer annoyances with generics (function =<T>() {}) where = and < here would be different tokens.
Although that's not relevant unless we have arbitrary operators (= will probably never be overloadable).
@JRL I'll put this plainly - that's really hard to read. Not only is there far too many words, the text doesn't actually say what the proposal is. For example, there's no clear definition of what the method definition is before the words $val1 = $int->__add($dec, true);.
Maybe @crell can help...
JRL
JRL
14:40
@Danack The RFC?
yes.
JRL
JRL
most of it is there due to feedback actually
it is quite large, which is a concern i expressed in the mailing list i think
i could put the proposal section at the top
that would probably be a good start to improving it
Starting with a new doc, and only copying across the words that are needed is probably going to be quicker. And putting it on github so people can suggest edits....
JRL
JRL
it's funny, started it on github and then the only people who even appeared to look at it was Mike who made a PR with all kinds of useless code that totally didn't fit anything in the RFC
probably also steal the complex number example from one of the other RFCs. That is something that should be possible in PHP. The example $first = $queue - 1; // With the - overload used to pop is ......a good example of usage people won't like to see.
@JRL which Mike?
JRL
JRL
14:45
chatterbox
Schatterbox
don't remember his name, let me check
schinkel?
JRL
JRL
yeah
thats it
@Danack I do have a complex number example actually
not a code example i guess
btw I realise giving and receiving feedback is difficult - with two vids from the lovely day9 that explains the core problem - How to Give & Receive Good Feedback - Feedback is Dumb and It Doesn't Matter
JRL
JRL
when i initially proposed it, most people flat ignored my messages, and the only people who responded basically flat rejected the idea. which to some degree i understand. i have never participated before, it's a big project that's lots of work and it wasn't clear if i was asking someone else to volunteer to do my idea.
the people who did respond with something other than "lol no because fuck that" wanted to see what my answers/solutions were to some very specific pointed things
those answers and the comlpeteness they require are why it's so long
JRL
JRL
14:52
for instance, i had to restate the answer to why commutativity is not desired for this feature several times
several people looked at the RFC when it was like... 1/10 the size and didn't even read enough to see that it wasn't just a copy and paste of the problematic proposal for the feature in 2020
Yes, writing effective persuasive RFCs is more difficult than you might think.
JRL
JRL
so i kind of figured... this is so complicated and needs so much documentation and education, if people aren't going to read it anyway, and it isn't going to pass because people are like "lol no fuck that", why not just fully document the proposal? like, all of it, so that anyone that actually wants to put the effort into reading it can understand the entire thing.
What do you think your eta is for getting the code 'done', and wanting to put the RFC to the list? If Crell's not available, I might be able to help at some point...but not guaranteed.
JRL
JRL
eh... end of the year is probably when i'll have a passing build with the critical test cases
solving the greater than operator left-right ordering issue is basically the only thing left
which i wanted to do with an opcode
and... joe, i think, wants me to do with a compiler change to store the ordering of the operands in an extra values field of the opline
because i was exploring the idea of replacing comparison methods in core with enums of some kind and that scared the shit out of him it seemed, lol
all the test case failures left that i've looked at stem from the greater than "optimization" to a reversed less than
00:00 - 15:0015:00 - 00:00

« first day (4061 days earlier)      last day (1112 days later) »