Page 1 of 1

Suggested approach for missing functions

PostPosted: January 11th, 2016, 1:13 am
by weirdan
What kind of approach you would suggest to implement missing functions (like some of the functions from (stream?_)socket_* family)? I would like to keep part of the codebase compatible with php.

Variants I thought of:
  1. Implementing missing functions as a library. Would compatibility with existing functions like stream_socket_server (in PhpNetClassLibrary) be a problem? It seems linking a library providing implementation of a function already defined in PhpNetClassLibrary (with FunctionImplOptions.NotSupported) is, well, not supported :)
  2. Implementing a 'facade' interface and providing two implementation for it - one would be used where all functions are available (in vanilla php), and the other one would call in to .net sockets (probably bypassing Phalanger-provided socket functions as those don't seem to be fully developed yet).
  3. Implementing another backend for existing socket library. Socket libraries do not seem to be particularly popular in PHP world. Searching for 'php socket library' on github yields repositories with less than 10 forks in the top.

Re: Suggested approach for missing functions

PostPosted: February 10th, 2016, 11:29 am
by Jakub Misek
Missing functions should be implemented in PhpNetClasslibrary (https://github.com/DEVSENSE/Phalanger/t ... assLibrary) :-)

In this way compiler won't break and you will be notified during compile time, there is an unsupported function usage. Preferred is to implement the functions you need and share it with community :-)