> > The RFC is at https://wiki.php.net/rfc/attributes_v2
> >
> > A working patch is at https://github.com/beberlei/php-src/pull/2 though
> > work around the details is still necessary.
> >
> > The RFC contains a section with common criticism and objections to
> > attributes, and I hope to have coll
On Wed, 29 Jan 2020, 7:42 pm Peter Bowyer,
wrote:
> On Tue, 28 Jan 2020 at 17:12, Rowan Tommins
> wrote:
>
> > I'd just like to point out that those two things are orthogonal: the fact
> > that Swoole is distributed as an extension is not the reason it's
> > incompatible with your existing code,
> > I'm not sure that would work well for Web Sockets, because it still
> relies on the traditional request-response cycle, but I've never really
> used them, so don't know what kind of architectural patterns make sense for
> them.
>
> Considering the Swoole PHP extension (https://www.swoole.co.uk)
Hi Rowan
> Could you share some more thoughts on what you are thinking of here? I'm
> guessing you're thinking along the lines of an "event-based" system,
> where each request is a function call, rather than a whole script
> invocation?
Yes that is what I was thinking, for example there is a user
PHP is pretty unusual in comparison to most web platforms nowadays as it
runs each request in an isolated process. Web development in other
languages is instead based around a long lived set of processes, which
serve multiple requests.
That model has advantages in that it is very easy to cache dat
> So essentially we are talking about generics. I think it's the best time to
> do so... Maybe our wishes come true soon? ;)
>
Given that the general trend is towards making PHP more statically
typed and very java/C# like, why not just ditch PHP and use one of the
aforementioned languages?
--
PH
tly. (There is an argument to be made that we could split #3 into
> higher level APIs and lower level AST manipulation which, IMO, should be two
> different debates, for a total of at least 4 different debates here.)
>
> So again, when I am proposing userland preloading I am *not*
>
> Hi folks, i think that we are getting a little confused here due to using
the term 'preloading' for different things. As i have noted previously, my
initial proposal of compile time execution would not depend on php's
preloading feature, but could work, with opcache in the usual sense, or
even
I would say that my proposal is more about compile-time meta
programming, and thus would not actually depend on preloading. It
could also be ran during page requests and would be cached by opcache
in the same way. However running it in that way could make the initial
request before the opcodes are
> Once you are in a live environment you want a read-only file system, for
> security and auditability. Code generation at that point is then impossible.
> Moving that code gen to a preloader wouldn't help with that.
My proposal has no impact on the file system. It would modify the AST,
and th
With PHP having recently introduced preloading, i have been thinking
about the possibility of adding a system whereby arbitrary php code
can run during this step. Essentially, this would serve the same
function as 'compile time execution' in many programming languages. It
should be noted that my th
> > I stand by my comment that this has *some* of the same problems as a
> > separate "build" script, such as the need to be configured correctly,
>
> I find repeating of this as overstating the concern simply because any
> programming language feature would need to be used correctly. So this als
> After posting my objection to pre-processing I remembered there was another
> reason I object to pre-processors that is even more significant than lack of
> composibility. And my objection extends to all the transpiring being done
> with Javascript and CSS too, although I put up with those be
Would it be worth expanding the ideas of programmatic constant
definition into a more general compile-time code execution approach?
It would work well with preloading introduced in 7.4, and could allow
some of the things frameworks are currently doing at runtime to be
done once at compile time (opc
Does this actually fit in with php's execution model of each request
being a separate thread / process? As far as I understand this kind of
async programming is only useful within an event-loop architecture as
used by nodejs for example. There are things that do this for php like
ReactPHP, but it i
>
> What are your thoughts about syntax such as the following, similar to the
> syntax for Java (only for use of functions/constants from the root scope)
>
> namespace My\NS;
> use function *;
> use const *;
> // can use functions/constants from namespaces that aren't the global
> namespace to o
> > > $say = switch (date("w")) {
> > case 0 => "weekend!";
> > case 1, 2, 3, 4, 5 => "weekday :(";
> > case 6 => "weekend!";
> > };
> > echo "Today is {$say}";
If you had a really long expression, it may be easier to read if the
assignment was moved to the end, perhaps like this:
sw
>
> That said... most polyfill files, of which there are a decent number, do some
> variation on:
>
>
> if (!function_exists('coolness')) {
> function coolness(int $coolLevel) { ... }
> }
> ?>
>
I can see quite a lot that could be done with preloading by executing
code once, essentially compil
@M. W. Moe If you don't like the java-isms you can ignore them to a
large extent, which I do. However in doing so you're going against the
grain and will end up writing a lot of stuff yourself. I do find it
weird how PHP has morphed so drastically from it's origins and also
wander why. If people wa
On Thu, 11 Apr 2019 at 00:43, Rowan Collins wrote:
>
> On 10 April 2019 21:56:41 BST, "Björn Larsson"
> wrote:
> >Could then the \($x) syntax be a good compromise between
> >readability & implementation?
>
This syntax does make sense to me, although only as I've seen it
before in Haskell, which
> On the balance of things, I would most certainly like to see leading and
> trailing whitespace render a string ineligible to be implicitly
> converted, but I'd be satisfied with (int)" 123 " converting without error.
>
Given that PHP seems to be gradually moving towards more type
strictness, wou
> I'd just like to amplify this mention of 3rd party tooling: if we go with
> something which requires complex lexer/parser rules, then every editor,
> IDE, and static analysis tool will need to also work with that syntax.
>
Is this actually a problem? Don't these tools make use of existing
parser
> - $waithandles = $this->urls->map(fn($url) => $this->fetcher->fetch($url));
> - $waithandles = $this->urls->map(\($url) => $this->fetcher->fetch($url));
> - $waithandles = $this->urls->map($url ==> $this->fetcher->fetch($url));
>
> I would say that when lambda functions occurs in function calls I
> Why? Wouldn't it be nice to align the behaviour of implicit and explicit
> casting, so that (int) "abc" throws a TypeError?
>
I agree with this. It would be odd if they behaved differently.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.
Why not just wrap the function in another function?
On Sat, 6 Apr 2019 at 23:46, Morgan Breden wrote:
>
> The problem I see with this approach is that a keyword for skipping
> parameters
> would really just be a stopgap solution until something like Named
> Parameters
> can be added.
>
> Is it re
> > If the static analyser was programmable, it would be possible to
> > provide it such information, within the scope of a single code base.
>
> In the case of data returned from a database, the metadata for the
> database is another source of information relating to that data, and it
> would be u
On Fri, 5 Apr 2019 at 13:15, Rowan Collins wrote:
>
> On Fri, 5 Apr 2019 at 12:42, Robert Hickman wrote:
>>
>> In the first case:
>>
>> function foo(callable $bar): int { return $bar(); }
>>
>> I think the value of $bar would have to fall into a set o
ome from somewhere, so it's
content would be defined by whatever that 'somewhere' is.
Getting back to the original topic, how would 'throws' interact with
exceptions raised by the php interpreter itself?
On Fri, 5 Apr 2019 at 12:12, Rowan Collins wrote:
>
> On
>
> The tricky part is that PHP is a highly dynamic language, so there's a lot
> of cases where the analysis can only return "maybe". My understanding is
> that this is what a lot of the work on Hack is doing: creating a language
> which looks a lot like PHP, but doesn't have as many ambiguous case
>
> For instance:
>
> function foo(): type nothrow {
> throw new SomethingException;
> }
Would it be possible to analyse the call graph at compile time
(bytecode generation) and then trigger a fatal error? It wouldn't be
possible for variable functions/methods though. A separate static
analyse
Is there any reason not to use 'php.net' raw without the 'www'?
On Mon, 1 Apr 2019 at 12:49, Derick Rethans wrote:
>
> Hi,
>
> I've just pushed the changes to the PHP website live, and fixed the
> apache config on php-web3, as it still had "php.net" as ServerName and
> "www.php.net" as ServerAlia
As long as it dosn't remove ' wrote:
>
> Hello,
>
> On Mon, 25 Mar 2019 at 14:02, G. P. B. wrote:
> >
> > Hello internals,
> >
> > I would like to start the discussion about the deprecation of PHP's short
> > open tags:
> > https://wiki.php.net/rfc/deprecate_php_short_tags
> >
> > As this is my fi
On Sat, 23 Mar 2019 at 20:17, dj.drezyna wrote:
>
> I wish have opportunity to set types not only like: function a(): string {}
> or function b(): ?string {}
> but also as: function c(): string | int {} or function d(): ?string |
> ?array {}// all of them should mark
> that null is accept
On Thu, 21 Mar 2019 at 16:15, Rowan Collins wrote:
>
> On Thu, 21 Mar 2019 at 15:21, Robert Hickman wrote:
>>
>> In this case nextIf() would have to be implemented something like:
>>
>> function nextif($someCondition) {
>> foreach($this-&
> But $filteredArrayIterator->next() is actually $arrayIterator->next() with
> a built-in if check, so you could also picture it as doing this:
>
> while ( $element = $arrayIterator->nextIf ( someCondition ) ) {
> $newArray[] = $element;
> }
>
In this case nextIf() would have to be implemente
nsides, whereas performance may be a downside.
On Thu, 21 Mar 2019 at 07:54, Rowan Collins wrote:
>
> On 21 March 2019 00:39:20 GMT+00:00, Robert Hickman
> wrote:
> >For my use case of PHP, get some content from a DB and dump it into a
> >template, I don't see much be
> > Hi!
> >
> >> It's not that you can't make an array into a generator, but you can't make
> >> an eagerly-evaluated expression into a lazily-evaluated one.
> > Not sure what you mean here.
>
>
> I mean that, given a syntax that lazily-evaluates something, you can
> "fast-forward" the result to ma
>> Honestly, I cannot think of any case where I'd use a comprehension
>> where I would definitely want an array and not a generator. In the
>> majority case both work equally well, cool, but I don't know when I
>> would even use an array-dependent version.
>> And converting from a generator to an
> > In python comprehensions on [] makes a list and comprehensions in {}
> > make a dictionary (list and dict comprehensions). As PHP only has one
> > 'array' type using [] makes sense. Along that train of thought, should
> > comprehensions also be possible in the old array() syntax?
>
> Honestly,
> > Why not apply the same approach to PHP? There is iterator_to_array() to
> > convert a generator to an array, so we may not need both syntaxes.
> > However, I think using [] for something that is *not an array* is
> > counter-intuitive.
>
> No, I would definitely be for []-syntax producing an ar
On Tue, 19 Mar 2019 at 00:55, Ben Ramsey wrote:
>
>
> On Mar 18, 2019, at 18:45, Robert Hickman wrote:
>
>
> 1: I have seen an extension which allows functions/classes to be
> redefined, although I can't remember what it is called.
>
>
>
> Maybe you’re thin
(I'm not a internals developer, but here are some ideas:)
1: I have seen an extension which allows functions/classes to be
redefined, although I can't remember what it is called.
2: It is possible to dynamically reload code if defined as anonymous
classes or functions using return include:
$cl
I saw in a previous discussion on the addition of JIT that
performance in web applications wasn't improved due to
data locality issues. I was just wandering weather it would be
possible to/worthwhile to add more facility to control data layout,
for those who may wish to do so, while leaving the exi
43 matches
Mail list logo