« first day (3869 days earlier)      last day (1078 days later) » 
00:00 - 15:0015:00 - 00:00

12:14 AM
@LeviMorrison So does that algorithm seem like a reasonable balance we can agree on?
 
 
1 hour later…
1:33 AM
(Probably the worst idea I've had, trying to explain myself when half asleep, but I also can't get to sleep because I keep trying to think how to explain this).
@PeeHaa I'm not going to expect everyone to watch a 46 minute video from Christoph Kern, but they do explain how Google has used this concept to get "a rigorous guarantee that SQL injection simply cannot happen" (@13:44)... and with XSS (@32:00), 1 project reported ~30 bugs in 2011, and ~0 from September 2013 (implemented date) to when the video was recorded in 2016 (as I note in the RFC, XSS isn't as easy, due to the context based escaping).
@Trowski I appreciate the view of not wanting to introduce the notion of some strings being "safer" than others. But, we are talking about using this check to identify Injection vulnerabilities (all forms, including XSS)... and this happens when user data is "injected" into a command string (SQL, HTML, CLI, and dare I say it, eval).
Or in other words - To address these injection mistakes, we must be able to identify "strings from a trusted developer" (this quote stolen from JavaScript isTemplateObject).
That said, I also appreciate the weird stuff developers can do, and that's why the name is important. By calling it is_literal(), we are clearly saying what it's checking for. This is why it's not called "is_safe_string()", because a programmer could do something really stupid, like taking user data, writing it to a PHP script, then executing that script (or using eval) to make it look safe.
I really want to keep this implementation simple, and easy to reason. String concat is currently used everywhere for SQL, HTML, CLI, and even Eval (don't use Eval). For ease of adoption I would like to support concat (more on this later). Splitting strings via substr(), explode(), etc - that's just going to complicate things.
@PeeHaa I would like to see any example where concat would "introduce things" in the context of a security issue (remembering the programmer wrote these strings). Unfortunately with security, I cannot say anything is perfectly safe, whereas to disprove, well you only need to find 1 example (game on?).
@DaveRandom I'm not familiar with PHP internals. It could be seen as a "const string"; but, as Joe noted, string concat can happen at compile time, so it should happen at runtime as well (consistency). This will help existing projects.
(e.g. I had to remove some uses of implode in my code, and now I'm using Joe's implementation, I know all of my SQL and HTML Snippets have been literals, and cannot contain user data - therefore cannot contain an injection vulnerability, or in other words, user data).
@DaveRandom And Yes (following on from the previous point), I agree, the same does apply, fundamentally const + const does mean that the programmer still has total control over the inputs.
@Trowski As to changing the implementation to reflection. I suspect that will break the concat cases, so it might work with ORMs (which typically provide methods that take small literals), but I suspect it's not going to be easy for everyone to adopt.
@Trowski Static analysis, as noted in the RFC - unfortunately you're not going to get every programmer to use it, especially newbies.
@Trowski Performance impact, as noted in the RFC, Máté Kocsis has run some tests, and it's not much (and can't really be measured when a database gets involved). That said, Joe also mentioned that VM changes might be possible to further reduce the cost if you're really concerned.
@Crell In regards to Database abstractions; if you look at the very primitive DBAL in my example, that literal_check() method is really simple/effective. If that was included in a more typical DBAL, it could be used by any method that takes an SQL string.
Then check the Doctorine security page, everything that is "NOT escaped", and "ALL other APIs to be not safe for user-input", could use this, and that provides a simple check that it's been given a programmer defined string.
Ok, that's probably far too much writing tonight, I hope I didn't come across as too mad.
:-(
 
It's a thing we used to do...
1 message moved to Trash can
 
sorry, I know I shouldn't have done that, I just don't know what else to do... and now sleep isn't working.
 
Remember the time we searched for older messages instead of typing new messages
 
Let's meet for a refreshing beverage soon.
@CraigFrancis It's fine. It's just a nice cleansing brain dump.
 
We used the pasted messages as our message instead of typing
 
1:46 AM
yeah, but can't do Friday, going to see the vampires (platelet donation).
I don't know how you all do it, text based messaging really takes it out of me.
 
Be autistic :X
 
@Danack If nothing else, it's a sign that this chat room lacks a way of filtering by topic easily...
 
I'm the opposite... dyslexic :-P ... which, to be fair, does help in other ways.
 
Be autistic :X (very, very dismissive, but it's easier to communicate over text as an autistic person... I have more time to form my response and don't have to deal with eye contact or body language)
Bloody mobile SO chat, probably my cue to sign out
 
@Tiffany Oh, I know that one... eye contact and body language is the same there :-)
@Tiffany Yeah, I should to... might just give it a minute for head to stop spinning... hope you have a good night :-)
 
1:52 AM
It was something I looked into, because I was curious if it was an "only me" thing, but it seems there's a higher percentage of high-functioning autistic people who prefer text-based communication over vocal psychologytoday.com/us/blog/aspergers-alive/201307/…
 
@Tiffany I don't know the details, but there have been a few cases where there have been "non functioning autistic people" (ugh, hate that phrase), and they were treated as non-comminative, but someone gave them a laptop, spent the time teaching them to type, and it turns out, they were human with thoughts and feelings (who would have thought it).
 
Too much sensory input :/ autistic people view colors differently, which I found interesting, well colors in pictures... landscapes... several objects together
 
@Tiffany, how do you deal with reading text and trying to understand someones tone. I often read things wrong, and it feels like they are being aggressive (not you, you're really good).
 
And in googling I've found out people with autism are also likely to experience synesthesia... that explains it
 
@Tiffany That's interesting, so mixing things up in a way.
 
1:59 AM
@CraigFrancis I'm absolutely terrible about interpreting sarcasm, unless it's someone I know who's already sarcastic like @DaveRandom, I always assume the best intentions
Unless I've learned a patterned phrase as "sarcastic" then I'm more able to interpret something as sarcastic
It's like machine learning on wetware
 
I think that kinda works on a logical level, but emotionally? as in, affecting how you feel, that I can't control.
I suspect your machine learning is better than most implementations.
 
"always assume" isn't entirely accurate... as I've become older, my interpretation of stuff has evolved over time, but it's basically like this... twitter.com/Magnus919/status/1366745634561220615
 
huh, so you start off with positive assumptions, then adjust over time?
 
Well... bullied repeatedly, yes
 
I'm sorry
Things better now?
 
2:05 AM
No worries
It was in my childhood, it took a few years of therapy and learning to accept myself
Moved to a new area three days away from my former home, new school, my peers were not kind.
 
Sorry you had to go though that, it's a horrible thing to go though.
do you feel more confident now, now that you know yourself more?
 
Confident, yes. But that basically means I'm a bit more comfortable in-person than I used to be. I'm more comfortable with myself. There's still the constant battle with self-esteem. (Typo, oops)
The little self-critical voice that never goes away.
 
I know that critical voice... and what it's worth, I've really enjoyed you being here, every time you talk it's been nice to see a friendly voice (text?)
 
Hah, thanks :)
 
anyway, it's past 3am now, got to be up in 3 hours so I best try to get some sleep, and thanks again :-)
(and for the psychologytoday article, nearly read it all, will finish tomorrow)
 
2:18 AM
The realization that autistic people are more likely to have synesthesia, several experiences in the past make so much more sense now. e.g. a hallway I used to dread at school because the smell and sight of it evoked a weird taste
 
I kinda get the smell to taste thing, but the sight it a new one on me.
Anyway g'night, and thanks again :-)
 
I think this hall had to be both the smell and sight combined. If it was an exclusive or of sight or smell, it wouldn't have evoked the same reaction.
Have a good night, hopefully you sleep :P
 
3:00 AM
I guess I've recently discovered my own first weirdism with PHP that is probably normal for others.
 
@Tiffany "Fixing" this a bit in 8.1 :) wiki.php.net/rfc/explicit_octal_notation
 
@Tiffany That's pretty typical in a lot of C-like languages.
Hindsight, explicit notation would have been better.
 
 
2 hours later…
4:57 AM
who is laravel/vue developer?
 
 
3 hours later…
7:32 AM
morns
 
 
2 hours later…
9:33 AM
Does anybody (@NikiC @JoeWatkins) have an idea what could cause this? (8.0.4 ZTS on Alpine (with muslc)):

_tsrm_ls_cache: initial-exec TLS resolves to dynamic definition
It is preventing a shared object (PHP extension) from loading.
 
is -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 in cflags for ext ?
 
yes
 
is it public ?
 
what exactly?
gah, now I have GCC crashing, joy
 
the extension, can I have a go with it ?
 
9:44 AM
no, sorry - but apparently apcu has the same issue
 
are you building static ?
 
no, it's an .so
fixed the GCC crash I think, needed to use --with-gnu-ld to php
 
oh yeah sorry, you said .so already
 
let me see if I can repro with apcu
 
Regarding the Partial Application Function would it be possible in the future to name args or change the position of args in future functionality extensions or proposed solution may harden this?

$fn = \explode(?delim, ?what);
$fn(what: 'Hello World!', delim: ' ');
 
9:47 AM
oh that's not standard libc
 
no, musl isn't.
it's a constant pain in the bum
 
@Derick uff
[some expletives about linkers omitted here]
 
It worked in < PHP 8.0 :-)
 
patch that to exclude musl from explicit model, if that doesn't work, try the other model
 
OK. I'll give that a go
 
10:01 AM
(excluding it makes it look like <8, I expect that to work if it worked before)
 
ugh, even detecting musl is a pain: stackoverflow.com/a/60471114/508057
 
> The musl team claims that there is no need of a way of detecting musl libc because they only implement standard functionality and have no quirks that need detecting.
I actually laughed, out loud
 
Yeah, LOL
 
you could just if #1 it for a test ?
 
@JoeWatkins @LeviMorrison @Trowski @Crell wiki.php.net/rfc/first_class_callable_syntax
7
 
10:10 AM
if that works I guess we'll need to mix some autotools potion ...
 
This is my counter-proposal to PFA
@JoeWatkins lol
 
@NikiC I'm totally good with that, very ready to wave goodbye to all of the ... everything ... for now anyway ...
have you already done a patch for that proposal ?
 
@JoeWatkins Nope, only wrote this just now. But I expect that it's going to be quite simple, something like a DO_FCALL replacement opcode that calls zend_create_fake_closure?
 
I have a very simple patch half done, it doesn't support magic yet
I tried fake closure first, and magic trampolines didn't work, so I broke it down in preparation for making magic work ...
 
@JoeWatkins Exactly what I'm doign :-)
 
10:19 AM
@JoeWatkins yeah, guess it needs the ~same logic as zend_create_closure_from_callable
 
you mind if I finish it ?
 
nope ^^
 
cool, I'll do that
 
Inedible syntax porridge ・ Compile Warning ・ #81058
 
@JoeWatkins Yeah, defining the macro to empty does the trick
hmm, maybe not...
rebuilding things helped
 
10:37 AM
@NikiC As long as it stays forward compatible with a potential PFA (which it does), fine by me - especially as we end up short on time for PHP 8.1 and this is minimally controversial
 
11:12 AM
@NikiC @JoeWatkins github.com/php/php-src/pull/7018 /cc @Gordon
You OK with me merging that?
 
@NikiC github.com/php/php-src/pull/7019 some ws issues, but I think looks okay ...
zend_compile.c seems to use different indentation to other files
or I dunno what's going on, but i used tabs, and it's gone strange ...
 
fuck me, I mistpype defined
 
yeah, just add a d, then fine by me :)
why CPPFLAGS and not CFLAGS ?
probably set in both
 
that's what all the other things did too: github.com/php/php-src/pull/7018/…
yeah, happy to put it in both, of course
 
I'm looking at the same link?
 
11:20 AM
yes, but not the same line?
just above it, there is:
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
                       [CFLAGS="$CFLAGS -fvisibility=hidden"])

case $host_alias in
  *solaris*)
    CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
    if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
      enable_libgcc=yes
    fi
    ;;
  *dgux*)
    CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR"
Done both now
 
it's actually okay in CPPFLAGS only, I checked a makefile, CPPFLAGS is included in COMMON_FLAGS
sorry, should have checked before ...
FTR, you can't send a link from an expanded view of a file on github, doesn't work ...
 
fail
 
@JoeWatkins Looks okay from a cursory look
@JoeWatkins Can/should I add your name on the RFC?
 
you can if you like
 
@Derick but there's nothing we can do about this to fix compatibility in extensions for versions not containing this fix, right?
 
11:30 AM
I doubt it
 
11:52 AM
it's likely the loading biinary and dso have to agree on a model, but you could try just manually replacing the template call to tsrmls_define at bottom of main compilation unit ... who knows ... I can't test any of this, I use a proper libc, with maximum quirks ...
(ZEND_TSRMLS_CACHE_DEFINE)
 
If you can make it work...
 
cmb
Would anyone know whether open_basedir=. is supposed to work for non CLI?
 
12:30 PM
@cmb Would . refer to the docroot in that case?
 
@bwoebi can you tell me what the test should look like ? we're doing this after init_fcall ... the scope of fbc must be correct all the time, no ?
 
@JoeWatkins Do B::method() with class A { function method() { var_dump(static::class); } } class B extends A {}
That should dump B rather than A
 
cmb
that doesnt work with IIS, since at startup CWD is the dir of php-cli
 
12:35 PM
@cmb Does it work during the request though?
Which checks are performed at startup? I'd assume ini paths?
 
cmb
@NikiC ah, indeed, that works! During startup, inis are checked.
 
12:50 PM
@JoeWatkins Did you see my proposal last night?
I think it covers the first-class-callable case, the pipe case, and the "other" case while still being sufficiently logical, and internally consistent.
 
I've read so many different versions of what we should do, that I don't know if I read the last version ...
but this I know ...
 
we shouldn't give equal weight to all use cases, the vast majority use case doesn't actually involve application, it involves avoiding clumsy syntax and callables ... t he patch to do that could have been written by any of us in an hour ... it doesn't have edges, it brings no complexity to the language, it actually solves a problem people have, and it's not going to take up another month of my life ...
3
giving about equal weight to all use cases is what pushed us in a wrongheaded direction, in my opinion ...
 
I wish PHP had a comparable macro system to rust … then people could develop their own syntaxes and we'd see what they actually use…
 
I agree we shouldn't give equal weight to all cases. But I disagree that "no application" will be the majority case. It would be used in conjunction with pipes in... probably nearly all cases. That and the 0-application case together form the vast majority use case, which I've been saying all along. :-) (And why I've argued that skipping reordering and stuff is easy peasy let's do it.)
 
1:02 PM
pipes don't exist, they're not a use case
 
But I think the proposal above covers both of those common cases very well.
The only reason I've not taken pipes to a vote yet is because people wanted PFA first.
The patch exists, it's just waiting on this to wrap up.
 
@NikiC This line here is true only until we start enforcing callable signatures:
> I think that the existing syntax is already sufficiently concise that there is no strong need to introduce an even shorter one.
I do not see any issues with shipping this first. It looks extendable, and is also useful.
 
@NikiC can I go ahead and merge github.com/php/php-src/pull/6981 (the ZEND_MM_ALIGNMENT changes in configure)
 
I think getting the "..." syntax in first makes sense; I can see lots of ways it can be extended to partial application
since it (I presume) generates a Closure object, we could do what Raku does and have a method that does the binding: docs.raku.org/type/Code#method_assuming
we could bind named and numbered args via array keys: foo(...)->assuming([1 => 42])
we could do that with dedicated syntax: foo(..., 1: 42)
or we could combine ... and ? as in some of the many iterations of the PFA proposal
 
@IMSoP Small nit: ... should always be the very last.
 
1:17 PM
I can see the reasoning for that; I was thinking of it as "... creates the closure, then 1:42 binds a value for arg 1"
but if you read the "..." as "and leave everything else alone" then last position makes sense, yes
the key is that any and all of these variations are compatible with foo(...), which would solve the long-standing issue of string and array callables
 
If we have a syntax that handles zero application and partial application at the same time, why drop half of it?
 
because we don't
 
@LeviMorrison Have you thoughts on my proposal?
@IMSoP Did you see my proposal yesterday afternoon?
 
but is there an implementation of that proposal?
 
@Crell Sorry, I've been busy. I have a meeting block I have to prep for now as well, so I won't have time to look at it for a few hours.
 
1:21 PM
I don't think Joe wants to implement anything else until we're done bikeshedding. :-)
 
I think everyone can agree that designing a partial application syntax has proven difficult; let's not rush it
getting the zero application case in gives us a huge win for 8.1, and takes the pressure off
I do really like the idea of a partial application syntax; but I don't like the idea of everyone burning out trying to agree the semantics and implement it, which seems to be what's happening at the moment
 
[is_literal](https://wiki.php.net/rfc/is_literal) justification (1 of idk, I'll post them at random)... why everyday programming needs to write commands as literals:

CakePHP [Query Builder](https://book.cakephp.org/3/en/orm/query-builder.html); Parts of the where() array need to be literals, because those string are added to the SQL:

$this->Articles->find()->where(['id != ' . $_GET['id']]);

$this->Articles->find()->where(['id !=' => $_GET['id']]);
 
1:39 PM
@Crell There is an alternative way to implement pipes though, and I'm not really convinced that the PFA-based implementation is better
@Girgias ugh
Can we like ... just not enable that warning?
 
@NikiC Oh I'm not planning on going through the whole php-src base there are way too many, I just want to make it possible for external extensions to be able to enable it
So it needs some fixing with APIs being exposed to extensions, but those are rather minimal
 
I am. For one, virtually every other language with pipes that I know of works on functions/callables, not expressions. Hack is the sole exception. Implementing the same operator as everyone else to do something not-really-the-same is encouraging people to be confused by (and therefore hate) PHP.

For another, making it a callable gives us more flexibility. For example, one of the things I intend to write is a series of utility functions (user space) that return a unary callable. map($func), filter($func), strcontains($needle), etc. That lets you use pipes almost as a method-esque call
 
ironically, anyone using those helpers wouldn't need PFA
I can see both versions being nicer in different cases, tbh
 
True, but there's innumerable cases where you would want a one-off function in your domain I don't have a wrapper for. Callable pipes give us both, and consistency with other languages.
 
as Nikita points out in the RFC, dedicated placeholders are much easier to make work with arbitrary expressions, which is cool
 
1:50 PM
@Crell Sorry, I don't follow
I don't see a difference between |> foo($$) and |> foo(?) beyond the former being more general and more efficient
I also very much do not want to see mixes like |> $callable |> foo(?) going on
I'd rather have |> $callable($$) |> foo($$)
Having consistent syntax there is something I view as an advantage, not a disadvantage
 
$arr |> itmap(fn($x) => $x*2) |> itfilter(fn($x) => $x > 0) |> collect() |> implode(',') |> length();
That also gets us close-ish to comprehensions.
 
@Crell so you want to make it a syntax expr |> expr ( parameters ) with the first operand being always appended as last parameter?
 
? No?
 
i.e. desugar $a |> $b($c) to $b($c, $a)`
well that's what your example looks like though
 
No. I want to do what a half dozen other languages do: $a |> $callable |> $callable |> $callable.

That the callable could be inline, a literal, a PFA, or the result of evaluating an expression gives us a ton of flexibility in a single operator, and opens up a huge array of possibilities.
I think it's valuable on its own even without PFA; the only reason I've not brought it to a vote yet is when I proposed it last year, the general response was "that would be nice, but we want PFAs first because writing fn($x) => on each line is icky."
 
1:58 PM
@Crell eih, so implode(',') is supposed to be a partial with only one param filled?
 
And also removes a huge array of possibilities, and makes the code non-idiomatic for PHP :)
@bwoebi This is with a hypothetical library that defines implode as implode($separator)($array), I assume.
 
@bwoebi In that example, it could be done as implode(',', ?) or as otherfunc(','), where otherfunc returns a callable. I was writing fast. :-)
 
ah okay
 
Which, yes, you can do if you want to shoehorn everything into your paradigm, but it's certainly not the natural way to do things in PHP, and I don't think it's what we should be optimizing for
 
@NikiC I don't see what possibilities it removes. And frankly I'd rather be consistent with other languages and higher-order functions than a one-off PHP-specific semantic.
 
2:01 PM
@Crell I don't think the "pipe" features in other languages are comparable (apart from Hack, which doesn't have the semantics you want)
In Haskell this is not a pipe, it's function concatenation
 
F# and Elixir have exactly the semantics I describe, and they've been proposed for Javascript. (As of last year it was still in discussion.)
 
Of course, those things have a surface similarity, but I think they are different enough that there could not possibly be any confusion between them
And I also think that taking how something is implemented in a purely functional language and blindly applying that to PHP is very ill-advised
 
Javascript is not a purely functional language. :-)
 
@Crell Yes, and pipes don't exist in javascript
A proposal is just that. We're also taking about proposals here :)
 
github.com/tc39/proposal-pipeline-operator - yeah and they don't even have settled on a choice what to prefer yet
 
2:06 PM
My goal is to make functional style code in PHP easier and more natural, and thus more common. Drawing inspiration from functional languages seems like a good strategy for that. "Stealing from other languages" has been the core guiding principle of PHP's evolution for 20 years. :-)
 
Memory leaks PDO MySQL reading blob field ・ PDO MySQL ・ #81059
 
Even that aside, as I showed above I think using arbitrary unary callables as the RHS gives us the most flexibility. It also has a trivial implementation. (It's trivial enough that even I was able to write it.)
 
@NikiC It's possible I'm thinking of an earlier incarnation of that function.
 
@Sara I vaguely remember killing that when it was merged into PHP
Because it like ... completely breaks the memory model
 
@Crell tbh, I think the starting point would be native function composition then, like haskells dot operator, if you actually want functional coding style instead of sort-of-unwrapped pipelining
pipelining feels very pseudo-functional
 
2:15 PM
@NikiC Yeah, it was bad and needed to feel bad. I may just not remember it being nixed.
 
Why? (Haskell's concat operator is backwards IMO, so I wouldn't want to use that.)
 
@Crell the point of functional programming … is building a big function and then resolving it, no?
 
I mean, I'm not against a callable contact operator, but I don't see how it's semantically different from pipe, given in PHP callables aren't true first class symbols. Pipe also has the advantage of being a single-direction read. Concat would end up with something like (foo . bar . baz . $beep )($val), which would be read as "take $val from the end, move it to the beginning, and then call each of these functions in turn." That's just weird.
 
@Crell (the first called function would be last, not first)
 
@bwoebi Ask 5 functional programmers what the "point" of FP is and you'll get 8 answers. :-) I would argue the key points are "thinking in pure functions, trivial combination of pure functions, and immutable values".
 
2:19 PM
so it'd be equivalent to the <| operator from F#
 
@bwoebi Yeah, that's what Haskell does. It's also why I really don't want to do what Haskell does here, because that's backwards. Telling people to suddenly read PHP right to left, sometimes, is a terrible idea.
Haskell's concat is most similar to F#'s <<, I think.
 
@Crell we … usually do it exactly that way. foo(bar(baz($beep($val))))
from right to left
 
And that is precisely the fugly I am trying to get rid of. Like... literally the example of what I want to eliminate. :-)
Because $val |> foo |> bar |> baz | $beep; reads far better, handles those functions being non-unary better (either with short lambdas, or ideally PFA), and compiles to the same opcodes as that so there's zero performance overhead.
And you can vertical-ize it easily if your case is longer, and it's still super readable.
 
I thought the fugly point was when you have multiple parameters which each are function calls, as in foo(baz($beep($val)), bar(1)) (where a foo(?, bar(1)) <| baz($beep($val)) would be more readable
 
Degrees of fugly. It gets worse the more other values you have to include.
 
2:23 PM
verticalization is an indicator that the chain is too long and there should be descriptive intermediary well-named variables
 
$val |> $beep |> baz(?) |> foo(?, bar(1)); // That's trivial to read. All left-to-right, like the rest of the language. Easy to make vertical.
@bwoebi Entirely disagree.
Point-free style actively tries to avoid intermediary variable names. Which pipe also enables.
 
I think there's space for pfa in the future, but after a month of trying to track everyone's thoughts, we've ended up with an RFC that doesn't match the implementation, and semantics that don't match either the RFC or the implementation ... whatever the details may be, we must agree that we are not in good shape to think about shipping anything in the next version of PHP ... this is simply more complicated than it first looks ...
we ought to just step back and think in our heads rather than all over the screen, and circle back round to this conversation ... because it's worth having, but it's not really going anywhere right now ...
 
@NikiC We should be able to make that interaction efficient like Hack's, but even if we cannot, there are real differences e.g. $val |> foo(bar($$)) is different from $val |> foo(bar(?)).
 
And in that case I'd rather see $val |> bar(?) |> foo(?) anyway. That's what you likely mean in that case to begin with.
 
Snerks at: $alsoClosure = $closure(...); as valid syntax. I mean, it is, but it's one of those silly examples of generic syntax. :)
TBQH, I'd actually like to blacklist the last three types of first-class callable in that list:
'strlen'(...);
[$obj, 'method'](...);
[Foo::class, 'method'](...);
I just think we need to encourage NOT using those callables as much as we can. Even if it requires a little extra work in the parser to say, "ugh... no, please don't"
 
2:41 PM
We can probably deprecate them in a future version.
Not in the same version that the new syntax is introduced, whatever it is.
 
Don't need to deprecate something that's never allowed. tapping-forehead.gif)
 
New syntax in 8.1, deprecate in 8.3, remove in 9.0.
 
Maybe the right thing to do is just effing deprecate those callables NOW.
 
@Sara i think he means deprecate callable completely ( string callables, arrays .. etc )
 
We have Closure::fromCallable. Put yet big-girl panties on and step into the 2010s
@SaifEddinGmati Right. But I'm saying that knowing we want to deprecate those eventually, it's best to not introduce a new way to create them.
 
2:43 PM
if callable is deprecated, we would also need to deprecate Closure::fromCallable
@Sara yea, i agree
 
Of course, the reality is that this still works: $callable = [ 'class', 'method' ]; $callable(...); so maybe I'm tilting at windmills
 
Now I don't think we're talking about the same thing... :-)
 
Solid +1 for voting on deprecating [$foo, 'bar'] and 'funcname' the second (...) gets accepted
 
If you're typing 'strlen'(...); into your code, then you're a monster who deserves what they get.
 
don't allow creating a partial from a callable directly.

`['foo', 'bar'](...)` -> error
`$c = ['foo', 'bar']; $c(...)` -> allowed

which makes sense if callable is to be deprecated in the future
 
2:46 PM
Oh I'd be all in favor of disallowing silliness like that out of the gate.
 
@SaifEddinGmati Right. I'm basically saying that, but I'm also convincing myself it doesn't actually buy us a ton.
 
I just don't think we can make [$foo, 'bar'](4, 5, 6) an error YET.
 
@Crell Oh yeah no. Because that's already legal syntax and needs deprecating slowly.
 
Kick off the process as soon as we have an alternative, which would be Nikita's RFC or PFA
 
@Sara But this gives you a nice way to go from an arbitrary callable to a proper closure
 
2:47 PM
So does Closure::fromCallable()
 
Though I could see the argument that you should use Closure::fromCallable() for that case
 
@Sara I think the array syntax can be removed, but the string syntax shall not "prefix_$name"(...), because there is no real alternative syntax unless you use a tempvar
 
I think we actually don't have any AST-level distinction between strlen() and 'strlen'() ^^
 
@bwoebi Closure::fromCallable("prefix_$name") ?
strlen() is T_STRING '(' ')' 'strlen'() would be T_CONSTANT_ENCAPSED_STRING '(' ')' (or something close to that)
So we could have a distinction in the AST
 
@Sara on the AST level, not the parser level
 
2:49 PM
Whether or not we DO is another question
 
yeah okay
@Sara and nah, the array syntax shall be removed at some point from the language (I think), but bare string syntax shouldn't
 
The main thing I'm hearing from reddit.com/r/PHP/comments/ngzd01/… is that strlen(...) can be a pretty confusing syntax
 
@bwoebi I would disagree with that statement.
 
I mean, we should also allow A::{"myString"}(...)
 
@bwoebi That's a different case
 
2:51 PM
because that's a real alternative to the array syntax
 
'strlen'() works (on a spec level) by invoking a callable (even if on an implementation level, it just does a normal function call right now)
Anyway, I'm wondering if it might not be better to pick a "more obvious" syntax, even if it's not compatible with PFA
Like the dreaded strlen::callable or callable(strlen)
 
foo(...?)
 
Those are not as nice as strlen(...), but arguably clearer
 
@NikiC eew.
 
...$ unpack values, ...? unpack partials
 
2:56 PM
@NikiC what is strlen? string? or const? this is IMHO is more confusing. i see it as a call to function named 'callable' with a constant named 'strlen'.
 
@NikiC I do dread it
 
@NikiC Yeah, that's how bare-string calls work right now. I think these also should be deprecated at some point (think PHP 9 or 10) and then there would be only first class "strlen"(...) left (or $stringVar(...))
 
@SaifEddinGmati Well, the first syntax is the same as Foo::class
So at least that one should be super obvious, by analogy
@bwoebi Okay, I see now what you mean
Yes, I agree then that should be supported
 
::function reads okay, (and doesn't re-use a thing that is probably destined to die) but it's lots of typing ...
 
00:00 - 15:0015:00 - 00:00

« first day (3869 days earlier)      last day (1078 days later) »