Re: [PHP-DEV] Please allow an out of readonly properties
Hello, If we keep the idea of using reflection aside, I still have a reason to consider readonly flag for private properties. There are two main uses I consider of readonly properties: prevention of property modification from the public scope and the securing the property from losing an important handle. What if the properties are set readonly with the private scope, so they are secured from getting modified, even within a class. IF it is a protected and read only property, it can also be further secured in sub classes. Internals, I want to appreciate Andreas for choosing a considerate tone for communicating the opinion that is different from the opinion shared above. What if we all at least try and adjust the tone like Andreas has done? Regards Hamza On 12/4/22, Andreas Heigl wrote: > Hey there > > On 03.12.22 23:55, Karoly Negyesi wrote: >> They refuse to compromise even on documentation issues. I am totally >> helpless. Not sure what could be done? > > When people design their systems and use final, private or readonly, > they have a reason for that. They have a plan on how their library > should be used and also how their library should not be used.That is the > API that is exposed via public methods that is described in the > documentation. > > When *your* code can only make use of a library by tweaking these > constraints, you are using the library in a way that is not intended by > the authors. > > There can be two reasons to that: Either you know exactly what you are > doing and you are willing to risk that the way you are using said > library might break with every patch version as the internal workings > might change. > > HERE BE DRAGONS: I sometimes actually need to do that (even with a > library I wrote myself) but instead of using reflection I then tend to > use monkey-patching in that case and actually rewrite the code of the > lib on installation. That way the execution is faster as I do not rely > on reflection but can access a public property directly. > > Or - and that is most of the time the case - you are using the library > wrong or even using the wrong library. > > And as you already contacted the authors and they declined your request > to change their API, the chances are high, that you are using their > Library in an unintended way. > > In that case you should reconsider what you are doing. Am I using the > right library? Why could I be using the library wrongly? How can I > change my code to use the provided API of the library? > > > In the end it always boils down to: Check whether your usecase is what > the library is intended to solve. And if there is no way around > rewriting upstream code: You are on your own! You can not rely upon > anything. Not even language features. You are not using upstream code, > you are abusing it. > > My 0.02 € > > Cheers > > Andreas > >> >> On Sat, Dec 3, 2022 at 2:48 PM Marco Pivetta wrote: >> >>> Talk to the designers then: bringing your own political issues up to the >>> programming language/tooling only makes it worse long-term, for everyone >>> >>> >>> On Sat, 3 Dec 2022, 23:45 Karoly Negyesi, wrote: >>> I do not have the luxury of designing my own system. I am forced to use upstream. I can't help it and given the history of private usage and the refusal on relaxing them I do not see this improving with the readonly. At all. On Sat, Dec 3, 2022 at 2:42 PM Marco Pivetta wrote: > Terrible idea: reflection is mostly introspection tooling, and doesn't > really bend the rules of the type system, other than crossing scope > (it > "sees" more). > > Please consider designing your system to consider the constraints of > `readonly` properties, or design the constraints to fit your system > instead. > > Marco Pivetta > > https://twitter.com/Ocramius > > https://ocramius.github.io/ > > > On Sat, 3 Dec 2022 at 23:39, Karoly Negyesi > wrote: > >> Hello, >> >> If push comes to shove, private properties can be changed with >> reflection. >> >> Readonly properties can't. >> >> Please add a readonly toggle to reflection. >> >> Thanks >> >> Karoly Negyesi >> > >> > > -- >,,, > (o o) > +-ooO-(_)-Ooo-+ > | Andreas Heigl | > | mailto:andr...@heigl.org N 50°22'59.5" E 08°23'58" | > | https://andreas.heigl.org | > +-+ > | https://hei.gl/appointmentwithandreas | > +-+ > | GPG-Key: https://hei.gl/keyandreasheiglorg
Re: [PHP-DEV] PHP support for matrix operations - BLAS, LAPACK.
On Sun, Dec 4, 2022, 8:43 PM j adams wrote: > I apologize if I have the wrong mailing list here. I'm hoping ot ask the > PHP developer community if there's any appetite for functions to handle > matrix operations and scientific computing. > > I took a course on machine learning which had us code solutions using > matlab/octave. This year I embarked on trying to translate those functions > to PHP and have been quite surprised to learn that pure php is quite > inefficient for matrix multiplication. I've been trying to chase down an > effective way to perform matrix operations in PHP and posting my questions > and progress on this forum at PHPBuilder: > > https://board.phpbuilder.com/d/10403480-converting-matlab-machine-learning-routines-to-php-need-matrix-operations > > Fast matrix operations seem to be absolutely critical for machine learning, > at least for Support Vector Machines and Neural Networks. I know that there > is a FANN extension, but it seems to me that it would be beneficial for > PHP's use in scientific applications if it had support -- either natively > or via some extension -- for matrix operations and possibly other > statistical or scientific computations. Python has numpy, for example. > > How does everyone feel about BLAS or LAPACK extension for PHP? I'm poorly > equipped to cook up such a thing, but these libraries already exist and > could offer great improvements in performance. > I remember studying some ML algorithms back in 2015 and I felt PHP was lacking a lot in terms of matrix operations, specially invert a matrix. It would have been cool to have some fundamental functionalities baked in. >
[PHP-DEV] PHP support for matrix operations - BLAS, LAPACK.
I apologize if I have the wrong mailing list here. I'm hoping ot ask the PHP developer community if there's any appetite for functions to handle matrix operations and scientific computing. I took a course on machine learning which had us code solutions using matlab/octave. This year I embarked on trying to translate those functions to PHP and have been quite surprised to learn that pure php is quite inefficient for matrix multiplication. I've been trying to chase down an effective way to perform matrix operations in PHP and posting my questions and progress on this forum at PHPBuilder: https://board.phpbuilder.com/d/10403480-converting-matlab-machine-learning-routines-to-php-need-matrix-operations Fast matrix operations seem to be absolutely critical for machine learning, at least for Support Vector Machines and Neural Networks. I know that there is a FANN extension, but it seems to me that it would be beneficial for PHP's use in scientific applications if it had support -- either natively or via some extension -- for matrix operations and possibly other statistical or scientific computations. Python has numpy, for example. How does everyone feel about BLAS or LAPACK extension for PHP? I'm poorly equipped to cook up such a thing, but these libraries already exist and could offer great improvements in performance.
Re: [PHP-DEV] Please allow an out of readonly properties
Hey there On 03.12.22 23:55, Karoly Negyesi wrote: They refuse to compromise even on documentation issues. I am totally helpless. Not sure what could be done? When people design their systems and use final, private or readonly, they have a reason for that. They have a plan on how their library should be used and also how their library should not be used.That is the API that is exposed via public methods that is described in the documentation. When *your* code can only make use of a library by tweaking these constraints, you are using the library in a way that is not intended by the authors. There can be two reasons to that: Either you know exactly what you are doing and you are willing to risk that the way you are using said library might break with every patch version as the internal workings might change. HERE BE DRAGONS: I sometimes actually need to do that (even with a library I wrote myself) but instead of using reflection I then tend to use monkey-patching in that case and actually rewrite the code of the lib on installation. That way the execution is faster as I do not rely on reflection but can access a public property directly. Or - and that is most of the time the case - you are using the library wrong or even using the wrong library. And as you already contacted the authors and they declined your request to change their API, the chances are high, that you are using their Library in an unintended way. In that case you should reconsider what you are doing. Am I using the right library? Why could I be using the library wrongly? How can I change my code to use the provided API of the library? In the end it always boils down to: Check whether your usecase is what the library is intended to solve. And if there is no way around rewriting upstream code: You are on your own! You can not rely upon anything. Not even language features. You are not using upstream code, you are abusing it. My 0.02 € Cheers Andreas On Sat, Dec 3, 2022 at 2:48 PM Marco Pivetta wrote: Talk to the designers then: bringing your own political issues up to the programming language/tooling only makes it worse long-term, for everyone On Sat, 3 Dec 2022, 23:45 Karoly Negyesi, wrote: I do not have the luxury of designing my own system. I am forced to use upstream. I can't help it and given the history of private usage and the refusal on relaxing them I do not see this improving with the readonly. At all. On Sat, Dec 3, 2022 at 2:42 PM Marco Pivetta wrote: Terrible idea: reflection is mostly introspection tooling, and doesn't really bend the rules of the type system, other than crossing scope (it "sees" more). Please consider designing your system to consider the constraints of `readonly` properties, or design the constraints to fit your system instead. Marco Pivetta https://twitter.com/Ocramius https://ocramius.github.io/ On Sat, 3 Dec 2022 at 23:39, Karoly Negyesi wrote: Hello, If push comes to shove, private properties can be changed with reflection. Readonly properties can't. Please add a readonly toggle to reflection. Thanks Karoly Negyesi -- ,,, (o o) +-ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andr...@heigl.org N 50°22'59.5" E 08°23'58" | | https://andreas.heigl.org | +-+ | https://hei.gl/appointmentwithandreas | +-+ | GPG-Key: https://hei.gl/keyandreasheiglorg | +-+ OpenPGP_signature Description: OpenPGP digital signature