abertschi / graalphp

An efficient PHP implementation built on GraalVM
https://abertschi.ch/blog/2020/building-graalphp/
Apache License 2.0
285 stars 13 forks source link

string type + concat operator + str_contains function #72

Closed avierr closed 3 years ago

avierr commented 3 years ago

very initial implementation

contains:

what doesn't work:

but should be enough to start implementing a lot of those PHP string functions.

avierr commented 3 years ago

@abertschi Those CodeFactor checks could be ignored I guess. Let me know if I have gone awfully wrong 😅

Girgias commented 3 years ago
* binary strings

* doesn't care about encoding

PHP strings are also byte arrays therefore don't care about encodings, however this could be a problem to implement the str functions as they work on a byte level not on a "character"/grapheme

abertschi commented 3 years ago

@abertschi Those CodeFactor checks could be ignored I guess. Let me know if I have gone awfully wrong sweat_smile

While I appreciate your efforts in contributing to this project, your submitted code is nowhere near where I could merge it into master. Implementing string functionality is rather involved. As you pointed out implicit and explicit casts must be supported and most nodes which currently support other data types such as integer must be extended to deal with strings.

I don't think re-implementing all string functions is very efficient in terms of time spent. I much rather would evaluate how standard library functions written by the Zend Engine project can be reused. See my answer [0].

I currently do not have much capacity to do mentoring. At the current point of your submitted code I much rather implement the functionality myself than mentor you through changes to achieve the desired functionality. I hope this gives you some feedback.

You may want to look through other issues and start with less involved tasks to contribute. But also there, the list and description of features is rather sparse.

[0] - https://github.com/abertschi/graalphp/issues/57#issuecomment-699504478

abertschi commented 3 years ago

If you want to get more familiar with Graal and Truffle, here is a useful compilation of resources:

avierr commented 3 years ago

At the current point of your submitted code I much rather implement the functionality myself than mentor you through changes to achieve the desired functionality.

Yeah, this would be good learning for me to see and compare what I missed.

But also there, the list and description of features is rather sparse.

You might want to expand on a few of these, I'll see what I can pick up myself as well.

Thanks @abertschi , might be a while before I am actually useful but hopefully soon 😄