Re: [PHP-DEV] Better development streamlining of the built-in server

2024-11-19 Thread Bruce Weirdan
uction server. Why couldn't you just do ```php if (php_sapi_name() === 'cli-server') { $_ENV['APP_ENV'] = 'development'; } ``` in your entry point script? -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] [RFC] Default expression

2024-08-26 Thread Bruce Weirdan
form of contravariant return, and thus breaks Liskov Substitution Principle. Your suggestion of making it an opaque value that cannot be read outside of the called function is a nice (and maybe the only) way to resolve this problem. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Bruce Weirdan
re less ergonomic than what we already have now in docblocks. -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] [RFC] Decoding HTML and the Ambiguous Ampersand

2024-08-22 Thread Bruce Weirdan
ecode.xml -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4

2024-06-25 Thread Bruce Weirdan
Is there a reason to keep crc32? -- Best regards, Bruce Weirdan mailto: weir...@gmail.com

Re: [PHP-DEV] Add $this return type

2024-06-25 Thread Bruce Weirdan
On Tue, Jun 25, 2024 at 9:51 AM Luigi Cardamone wrote: > > Is it possible to replace "$this" with "this"? Cleaner and coherent with > "self". > That wouldn't be possible, as `this` is a valid class name: https://3v4l.org

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-20 Thread Bruce Weirdan
This definitely looks like a powerful feature I'm looking forward to. If property/param/return guards are implemented, do you see them eventually replacing the property/param/return types we have nowadays? Asking for a friend.

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

2024-04-02 Thread Bruce Weirdan
nd it very confusing if the following crashed ```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 a

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.

Re: [PHP-DEV] Implement SeekableIterator for SplObjectStorage

2024-03-10 Thread Bruce Weirdan
jectStorage 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

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] [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

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

2024-02-27 Thread Bruce Weirdan
ed this way and found some technical obstacles. If you did, it would probably 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] [PDO] 2 phase commit

2023-11-30 Thread Bruce Weirdan
ttps://www.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. --

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

2023-09-18 Thread Bruce Weirdan
$FileName { readfile($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 >

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

2023-06-20 Thread Bruce Weirdan
()` if we 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] RFC [Discussion]: Closure self-reference

2023-06-06 Thread Bruce Weirdan
eone may *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: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-14 Thread Bruce Weirdan
rather than 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`

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,

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 a

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-04 Thread Josh Bruce
> While I understand the proposed feature is opt-int it introduces more magic > that can be solved using more verbose and IMO cleaner solutions. Understood and appreciate the position. > This is somehow confusing, why is the $response storing object ref is ok > while inclining the new object crea

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] [RFC][Discussion] Objects can be declared falsifiable

2022-11-03 Thread Josh Bruce
laude Pache wrote: > > > >> Le 3 nov. 2022 à 02:51, Josh Bruce > <mailto:j...@joshbruce.dev>> a écrit : >> >> Similar to: >> >> function x(?SomeType $arg): ?SomeOtherType >> >> Instead of: >> >> function x(SomeType|null

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-02 Thread Josh Bruce
Thank you all for the engagement so far. (Note: All scalar types and one compound type can be cast as true or false natively - of the scalar and compound types, callable and object are the only two with no, native false representation.) > Have you tried not initializing invalid objects? This co

[PHP-DEV] Change email address associated with account

2022-10-31 Thread Josh Bruce
Hey Internals! Apologies if this is the wrong space. I’d like to change my email address for internals but don’t want to lose ownership (??) of the falsifiable RFC: https://wiki.php.net/rfc/objects-can-be-falsifiable Is this possible? Should I be posting this somewhere else, if so, where? Che

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-10-31 Thread Josh Bruce
today, the last example is always true. You wouldn’t be able to create a guard clause for the negation: If ( $obj = Object::init($response) and $obj === false ) { // handle invalid object, which could include something like $obj->failed() } Cheers, Josh > On Sep 26, 2020, at 5:20

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 https://3v4l.org/BE

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')){ >define('otherconstan

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
;Has words' field): 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
work [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
adonly 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,

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

2021-06-28 Thread Bruce Weirdan
y time. Now that's 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 mail

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 regard

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

2021-06-23 Thread Bruce Weirdan
far from there 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] [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 Dev

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

2021-06-18 Thread Bruce Weirdan
hes `literal-int` from `int` and considers 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...@g

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 Mai

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

2021-05-13 Thread Bruce Weirdan
uage. -- 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
t 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

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

2021-04-01 Thread Bruce Weirdan
that type 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] 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] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-23 Thread Josh Bruce
> >> I actually like the idea of flags added to `is_array()` for this. >> >> Something like: >> >> is_array($value, ZERO_INDEXED | ASSOCIATIVE | INTEGER_INDEXED) >> >> I’m not suggesting these names; they’re for illustration only. > > I'm strongly opposed to adding any flags to is_array

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

2020-12-22 Thread Bruce Weirdan
PHP. But 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] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-22 Thread Josh Bruce
>> tl;dr: Could add flags to is_array. > > Please, no. > > PHP needs fewer flags, not more. > > -Mike lol - There’s something to be said for that. Thinking of “simple" bridges that can be built toward a possible larger discussion around naming and defining things and not adding more to the SL

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

2020-12-22 Thread Josh Bruce
> For example, with > >$a = ['foo', 'bar', 'baz’]; > > `is_list()` will return `true`, but if you run `$a` through `asort()`, > `is_list()` will return `false` because the keys are no longer > consecutive integers, but is there any doubt this is still a list? > Maybe in a pure sense, it’s n

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

2020-12-20 Thread Josh Bruce
I appreciate this idea as I ran into the same issue with one of my libraries when I wrote similar rules. Granted, I’m using “array” and “dictionary” not “list” as both terms seem common to the community and used to distinguish the two. But that’s semantics, which I’m sure will be discussed at

Re: [PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Josh Bruce
> > The reason why this has been deferred is because of which semantics should > be used for duplicate string keys. > > Do we use the addition between two arrays semantics or the array_merge() > semantics? See: https://3v4l.org/7QbWv > > As the previous RFC you linked initially wanted to use the

Re: [PHP-DEV] [RFC] Deprecate passing null to non-nullable arguments of internal functions

2020-12-01 Thread Josh Bruce
> On Dec 1, 2020, at 8:57 AM, Nikita Popov wrote: > > I've put up an RFC to make the handling of "null" arguments consistent > between internal and user-defined functions: > > https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg >

Re: [PHP-DEV] Nullsafe

2020-11-04 Thread Josh Bruce
> On Nov 4, 2020, at 1:38 PM, Eugene Sidelnyk wrote: > > Yeah... Creating null was a huge mistake. > Now it is probably too late to fix that (maybe some new language can > introduce that). > > But what do you think about introducing special class `NullObject`? I would rather let an instance be

Re: [PHP-DEV] Nullsafe

2020-11-04 Thread Josh Bruce
> Implicit nullable is terrible, moreover I don't see why users should return > null values more often. > They serve their purpose but most of the time you can use another sane/safe > default of the given > property type. > Agreed. I’m not overly opinionated about much, but null as a default

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-09-26 Thread Josh Bruce
continue going through the tutorials from Nikita and others on doing development Internals. Cheers, Josh > On Aug 30, 2020, at 9:32 AM, Josh Bruce wrote: > > Hey Tyson, > > This is great! Thank you so much, sincerely. > > Still slow goings, which is fine, we have

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-15 Thread Josh Bruce
> * If PHP had either convention or special handling for _ or $_ as a “ignore > this” destination, I wouldn’t have made the proposal. However, it doesn’t; _ > can (apparently!) be a constant, and is also a function, and $_ has no > special handling (and I bet it’s actually used to contain valu

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-03 Thread Josh Bruce
> > In terms of readability, I'm more likely to do > $keys = array_keys($array); > foreach($keys as $key){ Fair point. I would too. I have actually forgone even grabbing the keys and just using the loop without touching value in the body. Cheers, Josh -- PHP Internals - PHP Runtime Develo

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Josh Bruce
> On Sep 2, 2020, at 12:05 PM, Michael Voříšek - ČVUT FEL > wrote: > > I like "void", as "null" can be ambiguous. > > Imagine function example($a = 'default value 1', $b = 'default value 2') {} > > With "void", we can allow skipping arguments in advance to the default > pamameter value like

Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values

2020-09-02 Thread Josh Bruce
> On Sep 2, 2020, at 6:27 AM, Dik Takken wrote: > > On 02-09-2020 12:48, Olle Härstedt wrote: >> An alternative syntax would be >> >>foreach($iterable as $key => _) { ... } >> >> Using underscore as a way to signal "I don't care about this value". >> Same could be possible with list dest

Re: [PHP-DEV] Request for couple memory optimized array improvements

2020-09-01 Thread Josh Bruce
That’s interesting as I haven’t played with iterates and generators much. If the iterator can’t take an iterable, the idea of something like __toArray seems way more convenient: https://wiki.php.net/rfc/to-array Cheers, Josh > On Aug 31, 2020, at 4:39 PM, Michael Voříšek - ČVUT FEL > wrote:

Re: [PHP-DEV] array_reject() as counterpart of array_filter()

2020-08-31 Thread Josh Bruce
Just to confirm array_filter(“!is_int”, $collection) Would result in a collection of only non-integers?? I do think there’s something to be said for the communication of intent without syntax. array_without or array_reject reads easier to me than making sure to watch for the bang. Cheers, Jo

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

2020-08-30 Thread Bruce Weirdan
o pass a marker object 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] Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...)

2020-08-30 Thread Bruce Weirdan
matches have been found: $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 Josh Bruce
10:40 AM, tyson andre wrote: > > Hi Josh Bruce, > >> The compelling feature here for me is the idea of an “array walker” that can >> be broken out of. >> >> all() could be and() at which point this should be equivalent. > > Yes, you can write `all($set, $pre

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-08-30 Thread Josh Bruce
Hey Tyson, This is great! Thank you so much, sincerely. Still slow goings, which is fine, we have at least a year. lol Static analyzers seem to be the biggest concern to date. Haven’t been able to get one running locally - though I’ve only spent a few minutes here and there; definitely on the

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

2020-08-30 Thread Josh Bruce
Think I’m following. The compelling feature here for me is the idea of an “array walker” that can be broken out of. all() could be and() at which point this should be equivalent. $collection = [1, 2, 3]; If (count($collection) === count(array_filter($collection, “is_int”)) any() could be or(

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

2020-08-30 Thread Josh Bruce
>> >> - the default is `any($iterable, fn ($value) => ...)` >> - or `any($iterable, fn ($key) => expr, ARRAY_FILTER_USE_KEY)` >> - or `any($iterable, fn ($value, $key) => expr, ARRAY_FILTER_USE_BOTH)` > > Doesn't the occasional required use of long constant names like > ARRAY_FILTER_USE_KEY and

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

2020-08-29 Thread Josh Bruce
Hello! I’m still finding my understanding of actual internals, so can only comment from a PHP developer perspective. The “any” check is just to if anything in the itrerable passes the predicate, yeah?? What I find myself doing more often is wanting the first thing to satisfy the predicate - a

Re: [PHP-DEV] [Concept] Don't cast keys in array to int

2020-08-17 Thread Josh Bruce
Thanks Rowan. I can appreciate that rationale. Also let’s me in on why we might want to have an indexed array that is not necessarily sequential - but are integers. Thanks again. Cheers, Josh > On Aug 17, 2020, at 4:17 AM, Rowan Tommins wrote: > > On Mon, 17 Aug 2020 at 05:19, Michael Voříše

[PHP-DEV] [Concept] Don't cast keys in array to int

2020-08-16 Thread Josh Bruce
I’m sure this conversation has happened before. But it’s on my mind as I work on some things on wanted to ask internals real quick before getting back to it. [“2” => “hello”, “4” => “internals”] -> [2 => “hello”, 4 => “internals”] Meanwhile: [“hello”, “internals”] -> cast to object -> (“0” => “

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-08-09 Thread Josh Bruce
21, 2020, at 10:34 AM, Josh Bruce wrote: >> Learning more everyday. This thread will be the “official thread” - >> other related threads have been added to the RFC (including one from 11 >> years ago): https://bit.ly/php-0002-rfc <https://bit.ly/php-0002-rfc> >> >

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Josh Bruce
Have not tested - just catching up on emails. To verify: A property defined with a default value of the global does not already do this? Developer need: I rarely access global variables directly - usually going through a lib or framework. When I do I would probably wrap the access in a trait o

Re: [PHP-DEV] Allow two words keywords

2020-07-30 Thread Josh Bruce
Maybe add it to that thread?? https://externals.io/message/111218 Cheers, Josh > On Jul 30, 2020, at 4:50 AM, Deleu wrote: > > Such a nice syntax. Even better than @@ and @. I wish this could get more > attention/traction. > >> On Wed, Jul 29, 2020, 19:46 David Rodrigues wrote: >> >> Oh, y

Re: [PHP-DEV] Registration on wiki

2020-07-28 Thread Josh Bruce
Also be sure to add the mailing list address as the final email - the one you want to send emails to. This is the part I missed and received the same error. I don’t know if this counts as the captcha but the label is somewhat confusing, which is perfect if it’s meant to be the captcha Kalle men

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 rega

[PHP-DEV] Re: [RFC][Discussion] Objects can be declared falsifiable

2020-07-21 Thread Josh Bruce
Learning more everyday. This thread will be the “official thread” - other related threads have been added to the RFC (including one from 11 years ago): https://bit.ly/php-0002-rfc Created fork - with PR on fork to explore and leave notes without hitting the mailing

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-07-16 Thread Josh Bruce
> On Jul 16, 2020, at 10:28 AM, Josh Bruce wrote: > > https://wiki.php.net/rfc/objects-can-be-falsifiable > <https://wiki.php.net/rfc/objects-can-be-falsifiable> > > Updates: > > - Open issues (outstanding questions/concerns) updated > - Future scope

Re: [PHP-DEV] [RFC] Treat namespaced names as single token, relax reserved keyword restrictions

2020-07-16 Thread Josh Bruce
> On Jul 15, 2020, at 3:26 AM, Nikita Popov wrote: > > On Tue, Jul 14, 2020 at 5:37 PM Josh Bruce <mailto:j...@joshbruce.dev>> wrote: > New to the discussion and being this deep; so, apologies for any bumps. > Mainly questions. > > Does this only affect t

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-07-16 Thread Josh Bruce
https://wiki.php.net/rfc/objects-can-be-falsifiable Updates: - Open issues (outstanding questions/concerns) updated - Future scope - References now have links to original copies on GitHub (still updating 0002) - will be removed if accepted a

[PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2020-07-14 Thread Josh Bruce
Implement an interface and magic method to allow objects to represent false (or empty) while still be valid instances of the custom object (type). https://wiki.php.net/rfc/objects-can-be-falsifiable If you saw the latest from this morning, n

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Allow objects to declareemptiness and by extension truthiness

2020-07-14 Thread Josh Bruce
> On Jul 14, 2020, at 1:24 PM, Josh Bruce wrote: > > >> On Jul 13, 2020, at 12:14 PM, Christoph M. Becker wrote: >> >> On 13.07.2020 at 17:18, Josh Bruce wrote: >> >>> Re the wiki: I can edit pages now, it doesn’t look like I can create them. >

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Allow objects to declareemptiness and by extension truthiness

2020-07-14 Thread Josh Bruce
> On Jul 13, 2020, at 12:14 PM, Christoph M. Becker wrote: > > On 13.07.2020 at 17:18, Josh Bruce wrote: > >> Re the wiki: I can edit pages now, it doesn’t look like I can create them. >> There’s another thread I’ve been watching and I think I need more karma to >

Re: [PHP-DEV] [RFC] Treat namespaced names as single token, relax reserved keyword restrictions

2020-07-14 Thread Josh Bruce
New to the discussion and being this deep; so, apologies for any bumps. Mainly questions. Does this only affect the string after the “namespace” keyword (make implicit explicit)? So, things like “use” with a stack of classes within a base namespace would still be possible? On reserved words, i

Re: [PHP-DEV] Drop warning about non-public magic methods

2020-07-13 Thread Josh Bruce
Curious. I tend to follow PSR-12 (with few exceptions): https://www.php-fig.org/psr/psr-12/#44-methods-and-functions Which requires visibility declaration on all members (methods and properties). Would dropping the requirement mak

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Allow objects to declare emptiness and by extension truthiness

2020-07-13 Thread Josh Bruce
> > Latest version as we zero in on what this is really about: > https://bit.ly/php-0002 > > > I have a really hard time understanding what is actually being proposed here. > You mention the introduction of the Empt

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Allow objects to declare emptiness and by extension truthiness

2020-07-13 Thread Josh Bruce
>> Latest version as we zero in on what this is really about: >> https://bit.ly/php-0002 >> > 1) The 2 places that you have lists of "this thing produces true/false" could > likely stand to be turned into tables to make it clearer, especially when > demonstrating that

[PHP-DEV] [CONCEPT][DISCUSSION] Allow objects to declare emptiness and by extension truthiness

2020-07-12 Thread Josh Bruce
Latest version as we zero in on what this is really about: https://bit.ly/php-0002 Other threads: 1. https://externals.io/message/110879 2. https://externals.io/message/110881 Thanks for all th

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean

2020-07-12 Thread Josh Bruce
> > Focusing on Bool is, I think, a good choice because it has an argument for it > other than "well it works for strings." You hint at it in the writeup but > really bury the lead: Null objects. > > Being able to not use null or false as a "not found" case and instead return > an "empty" val

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean

2020-07-10 Thread Josh Bruce
>>> >>> Frankly this is something subject to personal opinions and will change >>> over time according to community shifts. >>> >> >> Not sure what's "subject to personal opinions" in the objective bug exposed >> in the snippet above? >> > > So there is a bug in a contrived code snippet ther

Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean

2020-07-09 Thread Josh Bruce
> On Jul 8, 2020, at 12:54 PM, Marcio Almada wrote: > > Hello Josh, > >> Link to working draft: https://bit.ly/php-0001 > > From a type safety POV I'd prefer to have an interface available, the > same way we did > to the Stringable interface RFC. But I'd rather keep t

[PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean

2020-07-08 Thread Josh Bruce
Link to working draft: https://bit.ly/php-0001 Discussion on implementing a means by which a class instance can interacted with syntactically as a boolean. At this point in the discuss the only means discussed is creation of a method (magic or via an interface). Abili

Re: [PHP-DEV] Proposal: A way for classes to define a response to any primitive type cast

2020-07-08 Thread Josh Bruce
 > On Jul 7, 2020, at 3:24 PM, Rowan Tommins wrote: > >> On 07/07/2020 18:13, Josh Bruce wrote: >> Decided to put something >> together:https://github.com/joshbruce/external-project-proposals/blob/master/php-concepts/interact-with-instance-as-php.md > > > H

Re: [PHP-DEV] Proposal: A way for classes to define a response to any primitive type cast

2020-07-07 Thread Josh Bruce
er.com/Ocramius > > http://ocramius.github.com/ > > > On Mon, Jul 6, 2020 at 4:17 PM Josh Bruce wrote: > >> Apologies, first time, still learning and have no historical context - >> timing is what it is. >> >> Proposal type: Concept >> >> Imp

[PHP-DEV] Proposal: A way for classes to define a response to any primitive type cast

2020-07-06 Thread Josh Bruce
Apologies, first time, still learning and have no historical context - timing is what it is. Proposal type: Concept Implementer: Unknown, fallback to me after slow learning Presumed simple implementation as the pattern should already be in place: Cast of (string) -> __toString() - already impl

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] Function pipe operator

2020-04-22 Thread Bruce Weirdan
gar to `$f($x)` with > > the 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] RFC: Server-Side Request and Response Objects (v2)

2020-02-14 Thread Bruce Weirdan
s to the parsed form 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: h

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

2019-11-25 Thread Bruce Weirdan
ING). That check would have to move to mysqli_stmt_execute, if it is > still to be performed. 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:

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

2019-10-24 Thread Bruce Weirdan
$_SERVER['phone'] !?? $user->setName($_SERVER['phone']); > $_SERVER['email'] !?? $user->setName($_SERVER['email']); What you described is already achievable with short-circuit && : isset($_SERVER['fname&#

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

  1   2   >