Skip to content

string implementation #69

Description

@solidpulse

I thought implementing string would be easy, but I was so wrong,
[https://github.com/avierr/graalphp/commit/58142efd3c8e3e65ac1be93d21edea32c35c9810]

PHP supports string interpolation,
probably this needs some pre-processing to convert it into string concatenation operations?

we know Java uses strings that are utf16 encoded.
strings in PHP are also used to store binary data, I went ahead and did some research on how others handle this,

1.PeachPie
https://github.com/peachpiecompiler/peachpie/blob/master/src/Peachpie.Runtime/PhpString.cs

2.JPHP
https://github.com/jphp-group/jphp/blob/master/jphp-runtime/src/php/runtime/memory/StringMemory.java

3.HippyVM
https://github.com/hippyvm/hippyvm/blob/master/hippy/objects/strobject.py

4.Tagua-vm
https://github.com/tagua-vm/tagua-vm (not sure how this works)

other challenges:
implicit casting rules that PHP has to convert strings to numbers and vis versa.
https://php.net/manual/en/language.types.type-juggling.php

Most of this is way out of my league, so I don't have any opinions on this, let me if anyone has any thoughts on which direction to proceed in

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions