Re: [PHP-DEV] Re: [RFC][Discuss] Arrow Functions

2017-02-01 Thread Bruce Weirdan
On Wed, Feb 01, 2017 at 07:45:50AM -0800, Rasmus Lerdorf wrote: > The reason it is feasible to do this for single-expression closures in this > short form syntax is that you don't typically need a local scope at all for > these short closures and the syntax doesn't convey the idea that you would >

Re: [PHP-DEV] Enumerated Types

2016-12-05 Thread Bruce Weirdan
> (Off-topic: there are some place where I can found the internals talking about that? > The externals.io not allows search.) http://markmail.org/search/?q=https%3A%2F%2Fwiki.php.net%2Frfc%2Fenum+#query:https%3A%2F%2Fwiki.php.net%2Frfc%2Fenum%20list%3Anet.php.lists.internals+page:1+state:facets

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Bruce Weirdan
On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > Proposed syntax > class A($prop) extends B("BlaBla", $prop) { > } Would this work with anonymous classes? If so, how would the syntax look like? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] RFC Draft: Comprehensions

2019-03-10 Thread Bruce Weirdan
> array_map and array_filter combined This example has array_map and array_filter in wrong order (duplicated once or twice below as well). The RFC proposes to allow multiple `for`s in comprehensions, and really could benefit from an example of such usage.

Re: [PHP-DEV] [RFC] JIT

2019-02-04 Thread Bruce Weirdan
After figuring out that opcache.jit_buffer_size is specified in bytes (not in megabytes, as RFC states) I got ~5% speedup running vimeo/psalm (static analyzer) on its own codebase with default JIT flags and ~7.3% with minimal JIT (1201). PHP+optimizer (-dopcache.jit_buffer_size=0): 32.29s

Re: [PHP-DEV] [RFC] JIT

2019-02-05 Thread Bruce Weirdan
On Tue, Feb 5, 2019 at 8:38 AM Dmitry Stogov wrote: > > PHP+optimizer (-dopcache.jit_buffer_size=0): 32.29s (100%) > > PHP+optimizer+JIT (-dopcache.jit_buffer_size=5000): 30.72s (95.1%) > > PHP+optimizer+minimalJIT (-dopcache.jit_buffer_size=5000 > > -dopcache.jit=1201): 29.95s (92.7%)

Re: [PHP-DEV][DISCUSSION] Multilingual PHP

2019-04-11 Thread Bruce Weirdan
something), so it implies you have a way to enter latin characters. Keyboard layout switching is a problem solved decades ago. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV][DISCUSSION] Multilingual PHP

2019-04-11 Thread Bruce Weirdan
ead of (LATIN SMALL LETTER C U+0063). Incidentally these two chars also share the same physical button in English/Russian keyboard layouts, so it's a mistake easy to make and very hard to spot visually: https://3v4l.org/rjjU9 -- Best regards, Bruce Weirdan

Re: [PHP-DEV] [RFC] Desire to move RFC add_str_begin_and_end_functions to a vote

2019-06-22 Thread Bruce Weirdan
is going to yield false negatives [1] [1] https://3v4l.org/4HgUL -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Symbol implementation

2019-04-27 Thread Bruce Weirdan
typehint=en=all -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] anti-coalescing-operator

2019-10-24 Thread Bruce Weirdan
e']); > $_SERVER['email'] !?? $user->setName($_SERVER['email']); What you described is already achievable with short-circuit && : isset($_SERVER['fname']) && $user->setName($_SERVER['fname']); Besides, it's a widely used idiom known from shell sc

Re: [PHP-DEV] mysqli needs a method to bind a single parameter

2019-11-25 Thread Bruce Weirdan
formed. If `bind_param` is allowed to do incomplete bind (as in your example where you supply 2 out of 3 required bound parameters) t hen there's no need for additional method, as you could simply do: if (isset($_GET['zip'])) $stmt->bind_param('s', $_GET['zip']); -- Best regards, B

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Bruce Weirdan
On Fri, Oct 11, 2019 at 2:43 PM Andreas Hennings wrote: > What other use cases exist for exit()? Setting exit code for cli scripts. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Server-Side Request and Response Objects (v2)

2020-02-14 Thread Bruce Weirdan
of php://input What about $query and $body? That would be closer to the terminology used in HTTP RFCs. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Initializing constants once, with code?

2020-01-02 Thread Bruce Weirdan
There's also a fourth approach that does not involve any changes to PHP: autoload + eval. When PHP is looking for your class, in your autoload you load the values from config, generate the class source and eval() it. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] [RFC] Function pipe operator

2020-04-22 Thread Bruce Weirdan
RFC), which allows to write e.g. `xs -: sort -: reverse` instead > > of `reverse (sort xs)` or `(reverse . sort) xs`. > > If I ever actually wrote Haskell, I'd find that extremely useful. :-) > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...)

2020-08-30 Thread Bruce Weirdan
ound: $none = new stdClass; $element = first($collection, fn($elt) => ...); if ($element === $none) { // nothing found } -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...)

2020-08-30 Thread Bruce Weirdan
ct and check > the identity of that to know if no matches have been found: > > $none = new stdClass; > $element = first($collection, fn($elt) => ...); > if ($element === $none) { >// nothing found > } > Of course it should have been `$element = first($collection, fn($elt) =>..., $none);` -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] [RFC] [Discussion] Remove inappropriate inheritance signature checks on private methods

2020-05-22 Thread Bruce Weirdan
Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] [RFC] [VOTE] Saner numeric strings

2020-07-22 Thread Bruce Weirdan
On Wed, Jul 22, 2020 at 4:21 PM Christian Schneider wrote: > but not to arithmetic *operators* like 42 + "" because that doesn't > currently trigger E_WARNING AFAIK. > It does produce warning since PHP 7.1 : https://3v4l.org/4CV1E -- Best regards,

Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-23 Thread Bruce Weirdan
if (is_array($array, $this->getFlags())) { ... } } ``` -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] #[Deprecated] Attribute

2020-12-22 Thread Bruce Weirdan
once it gets introduced and *if* it forbids usage on some elements it wouldn't be possible to fix this from userspace. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] Re: [RFC] is_literal

2021-06-16 Thread Bruce Weirdan
y used a lot). To clarify, do you imply that *all* integers are safe? Or would they also be differentiated into literal and non-literal varieties? -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] [RFC] Name issue - is_literal/is_trusted

2021-06-23 Thread Bruce Weirdan
> - String + int concatenation isn't an injection risk. I think this demonstrates it very well could be: https://externals.io/message/114988#115038 -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Developm

Re: [PHP-DEV] [RFC] Name issue - is_literal/is_trusted

2021-06-23 Thread Bruce Weirdan
real quick and now people can't even name the thing. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Re: [RFC] is_literal

2021-06-18 Thread Bruce Weirdan
iders the result of literal-string + int concatenation a non-literal string: https://psalm.dev/r/59ad602688 This may mean that Matthew's point has been misinterpreted. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Dev

Re: [PHP-DEV] [RFC] Partial function application

2021-05-13 Thread Bruce Weirdan
-- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC][Draft] Body-less __construct

2021-05-11 Thread Bruce Weirdan
want to make sure constructor is *not* defined, e.g. ``` private final function __construct(); ``` (often seen in singleton implementations). -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] is_literal() is back

2021-06-25 Thread Bruce Weirdan
On Sat, Jun 26, 2021 at 1:21 AM Craig Francis wrote: > We're going back to the original is_literal() proposal. > > https://wiki.php.net/rfc/is_literal Nice work! `chr()` returning literal strings is somewhat questionable, but otherwise this is looking very good. -- Best regards,

Re: [PHP-DEV] is_literal() compile-time awkwardness

2021-06-28 Thread Bruce Weirdan
a problem. If the same code produces different results for expression literalness depending on external factors like available memory it may pass in the test environment, but fail in production. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com --

Re: [PHP-DEV] [VOTE] noreturn type

2021-04-01 Thread Bruce Weirdan
as a part of function signature like you can do with other types. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] Add __toString() to DateInterval

2021-03-03 Thread Bruce Weirdan
Interface::format()) would solve that. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-04 Thread Bruce Weirdan
the code > decomposition taking into account ISP. Prior art: @psalm-require-extends and @psalm-require-implements Psalm annotations: https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-require-extends -- Best regards, Bruce Weirdan

Re: [PHP-DEV] Problems with the mailing list [was: Re: [PHP-DEV] Request for karma to vote on RFCs]

2021-07-20 Thread Bruce Weirdan
ld): list:(internals.lists.php.net) Do this: Never send it to Spam -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] intersection types and null for defaults, properties and return types

2021-07-19 Thread Bruce Weirdan
[1] [1] https://3v4l.org/EfmJq -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Bruce Weirdan
readonly it would probably be better to declare that with a class modifier. E.g. ```php readonly class Entity { public int $count; public string $data; } ``` Though `readonly` doesn't look like a perfect fit in that position to me. -- Best regards, Bruc

Re: [PHP-DEV] instance version of match ?

2022-03-28 Thread Bruce Weirdan
On Mon, Mar 28, 2022 at 7:56 PM Karoly Negyesi wrote: > match ($object) { > Someinterface => 'foo', > AnotherInterface => 'bar', > } > > this can not clash with any existing code as using identifiers like this > are a syntax error currently. That's valid code actually, see

Re: [PHP-DEV] [Strawpoll] Promoting redefining constant to exception

2022-01-25 Thread Bruce Weirdan
On Tue, Jan 25, 2022 at 9:45 PM Chase Peeler wrote: > it will make this much more difficult to read since the constants.php will > have to be > updated: > > if(!defined('dbserver')){ > define('dbserver','productiondb.example.com'); > } > if(!defined('otherconstant')){ >

Re: [PHP-DEV] RFC: Short echo tag can also call closures

2023-09-18 Thread Bruce Weirdan
e($FileName); }; > > > title ?> > bodyStream ?> > > > Thank you for considering! > > Regards, > Shailesh > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > -- Best regards,

Re: [PHP-DEV] [RFC][Dynamic class constant fetch]

2022-11-04 Thread Bruce Weirdan
On Fri, Nov 4, 2022 at 10:49 AM Marco Pivetta wrote: > What's convenient about `Foo::{$bar}` vs `constant(Foo::class . '::' . > $bar)`? I'm a bit confused by this :| >From the static analysis POV `Foo::{$bar}` is way better, as we can immediately see that the code is trying to access a constant

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-14 Thread Bruce Weirdan
n just using > new punctuation, if we wanted to encourage that analogy. Would this be allowed in files included in the methods of the anonymous class? `$this->` and `self::` is, and it's a pain point for static analyzers, forcing us to invent things like `@psalm-scope-this` -- Best rega

Re: [PHP-DEV] Class Re-implementation Mechanism

2023-02-21 Thread Bruce Weirdan
On Tue, Feb 21, 2023 at 7:53 AM someniatko wrote: > We want to write some tests for the Service class, but we don't want > to use a real SomeDependency instance > during tests. A common approach is to either extract an interface > (JUST to make it testable), or to drop the > `final` keyword and

Re: [PHP-DEV] RFC Idea - json_validate() validate schema

2023-03-02 Thread Bruce Weirdan
On Thu, Mar 2, 2023 at 1:23 PM Jakub Zelenka wrote: > The schema version should be specified by $schema keyword Unfortunately, it's not what happens in the wild. Some schemas even forbid `$schema` (e.g. Composer's one). -- Best regards, Bruce Weir

Re: [PHP-DEV] RFC [Discussion]: Closure self-reference

2023-06-06 Thread Bruce Weirdan
think* it would? -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: Fwd: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures

2023-06-20 Thread Bruce Weirdan
already know it will be deprecated and removed soon enough? -- Best regards, Bruce Weirdan mailto:weir...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [PDO] 2 phase commit

2023-11-30 Thread Bruce Weirdan
.postgresql.org/docs/current/two-phase.html), MySQL ( https://dev.mysql.com/doc/refman/8.0/en/xa.html) and Oracle ( https://docs.oracle.com/en/database/oracle/oracle-database/21/admin/distributed-transactions-concepts.html#GUID-8152084F-4760-4B89-A91C-9A84F81C23D1) all support it. -- Best regar

Re: [PHP-DEV] int|float for sleep? sleep(0.1) => sleep 0.1 seconds

2024-03-09 Thread Bruce Weirdan
Hi Jim On Sat, Mar 9, 2024, 20:46 Jim Winstead wrote: > If the adherence to semantic versioning is meant to be strict, PHP doesn't follow semver and never had.

Re: [PHP-DEV] Implement SeekableIterator for SplObjectStorage

2024-03-10 Thread Bruce Weirdan
ctStorage with an incompatible `seek()` already implemented (e.g. https://3v4l.org/uW9Yl), so it shouldn't happen in a patch release. Not that I expect there to be many of those, but still. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com

Re: [PHP-DEV] int|float for sleep? sleep(0.1) => sleep 0.1 seconds

2024-03-09 Thread Bruce Weirdan
On Sun, Mar 10, 2024 at 2:38 AM Jim Winstead wrote: > > On Sat, Mar 9, 2024, at 1:04 PM, Bruce Weirdan wrote: > > On Sat, Mar 9, 2024, 20:46 Jim Winstead wrote: > >> If the adherence to semantic versioning is meant to be strict, > > > > PHP doesn't follow semve

Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2

2024-03-11 Thread Bruce Weirdan
On Tue, Feb 27, 2024 at 6:22 PM Bruce Weirdan wrote: > > Hi Larry and others > > On Fri, Feb 23, 2024 at 12:57 AM Larry Garfield > wrote: > > > > > > I've added an FAQ section explaining why the Python/JS approach wouldn't > > really work. To be cl

Re: [PHP-DEV] [RFC][Concept] Data classes (a.k.a. structs)

2024-04-02 Thread Bruce Weirdan
php function f(Universe $_u): void {} $universe = new Universe(size:'big'); $shoe = new Shoe(size:'big); if ($shoe === $universe) { f($shoe); // shoe is *identical* to the universe, so it should be accepted wherever the universe is } ``` -- Best regards,

Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2

2024-02-27 Thread Bruce Weirdan
robably make sense to list them in the FAQ section. [1] https://wiki.php.net/rfc/property-hooks#why_not_pythonjavascript-style_accessor_methods -- Best regards, Bruce Weirdan mailto:weir...@gmail.com

Re: [PHP-DEV] [RFC] [Discussion] Deprecate GET/POST sessions

2024-03-04 Thread Bruce Weirdan
to also list `session.trans_sid_tags` and `session.trans_sid_hosts` as deprecated. And mentioning that `output_add_rewrite_var()` is unaffected wouldn't harm either. -- Best regards, Bruce Weirdan mailto:weir...@gmail.com