« first day (3172 days earlier)      last day (1767 days later) » 

12:06 AM
@PeeHaa How do you survive the first few hours in Ark? Playing alone, I always get eaten by huge dinos I haven't seen coming.
 
12:34 AM
@FélixGagnon-Grenier yeah, I can imagine. Good Omens is all happy and stuff. Granted, I haven't watched Chernobyl yet, so I don't know what the writing is like, or the premise, but I can take a guess.
@mega6382 yeah, makes sense. When you said the "hhhh," it made me think of Korean, and I think another language that uses "hhhh" to indicate laughter, without a vowel sound. Granted, in Korean, vowels rarely have a hard sound like they do in English (not aspirated), so ㅎㅎㅎㅎ would make more sense than 하하하하
@FélixGagnon-Grenier Good Omens is kinda like comfort food, I guess. It makes me feel all warm and fuzzy after watching.
 
12:52 AM
:P
@Tiffany yeah, it feels like that. Thing is, Chernobyl kinda is... I don't quite know how to coin it, perspective changing, maybe? We didn't know shit about nuclear, and it was a fucking disaster. We don't know shit about machine learning. We don't know shit about climate. I don't know, it's just different leagues, I guess.
 
1:18 AM
@FélixGagnon-Grenier not sure how far you got in Good Omens, but they touch on nuclear reactors too, in a more humorous way (I'm guessing)
I won't spoil what happens, but it's amusing to say the least
Man, one thing they should've mentioned in the show that's mentioned in the book is that any CD/tape/whatever left in Crowley's car for longer than two weeks inevitably turns in to a Best of Queen compilation
 
1:57 AM
I just got Ark with the $1 xbox game pass sale, excited to try it out.
 
2:22 AM
!!should I get pizza or no
 
You should no.
 
Dammit
 
 
6 hours later…
8:00 AM
lade to put a load or burden on or in : load
 
 
1 hour later…
9:07 AM
2
Q: Class new Instanse in php Mvc Structure

NewCod3rI working with own project using MVC structure and autoload class using PSR-4 using composer. I choose Php Fastroute library for my router engine. My Structure Is: index.php define('DS', DIRECTORY_SEPARATOR, true); define('BASE_PATH', dirname(__DIR__) . DS, TRUE); ini_set('display_errors', 1...

 
9:57 AM
here I am trying to get duplicate characters from string without using any loop.
But something is wrong in the code.. can someone please take a look.
https://3v4l.org/apVYa
 
morns
 
ThW
morning
@Exception in_array checks array values, but you need to check if the key (character) exists: 3v4l.org/pSaid
 
10:27 AM
thanks to point out that... But I need to get duplicate characters from string . So currently it is giving character and its corresponding array..
I will need like this->

Array
(
[f] => 2
)
found solution.. thanks
 
cmb
!!docs count_chars
 
[ count_chars() ] Return information about characters used in a string
 
Wes
11:03 AM
@DaveRandom @JoeWatkins any idea on how to proceed here? twitter.com/WesNetmo/status/1142747682500501507
 
11:40 AM
Which one is correct?
- Yes, they are keep updating
- Yes, they are being updated
 
@Shafizadeh the latter
 
headdesk Guess what's wrong with this:
 
hm?
 
The legacy version is legacy since April. Aka everyone who has Checkout from before then, needs to redo their payment flow. But there's no note about that on the main checkout page.
 
haha
 
11:53 AM
I read the first note on SCA that 'Checkout is ready' two months ago, and told a client that their system was going to be fine and didn't need any work.
 
we use recurly on top of stripe, still waiting for their guide on how to SCA. its supposed to be there end of june
 
I've also just made a new thing for myself, that uses the legacy checkout as I wasn't aware that there was a completely new version.
*headdesk*
*headdesk*
*headdesk*
*headdesk*
Guess I'll just throw that code away and start again.
@beberlei the main thing that has changed is that apparently the payment flow may redirect from your own domain to Stripe. i.e. it's not just contained in a lightbox now (I think).
 
yeah
 
For me, the way the purchases are no longer atomic (at least appear atomic to our backend servers) is a massive loss in how easy it is to use their payment platform.
 
Wes
12:41 PM
ok i managed to access the ast of a php file in the phpstorm plugin
 
1:19 PM
@mega6382 thx
 
2:06 PM
Morning
 
3:05 PM
o/
 
php-fpm status parsing – #78200
 
 
2 hours later…
4:58 PM
@Danack i dream of an paypal/generic api which has one api. one. Paypals value objects are nice. Now i only need to specify the way i want to proceed but paypal just found out a way to split it in 1043 diffrent apis \o/
 
@Danack I guess I'm late: @Danack fix bugs.php.net/bug.php?id=77490
 
Wes
5:28 PM
@NikiC ping
 
 
1 hour later…
6:34 PM
@Wes pong
 
Wes
@NikiC remember levi proposed var $var; to work like js' let, with lexical scoping read/write, without touching how variables work currently?
 
I don't think I was around for that
 
Wes
i am trying to develop the idea :B
 
Develop as in flesh out or as in implement?
 
Wes
on paper, i wish i knew how to do that kind of stuff
when a function is executed, are variable names in that function known before the execution starts?
obviously without including variable variables
 
6:39 PM
Then yes
I don't think it would even be that hard to implement
 
Wes
does bar() see $foo, here?
function bar(){

    function() use(&$foo){}

}
 
yes
 
Wes
$foo is firstly defined when the closure is executed
 
no, it's defined when the closure is created
 
Wes
oh right, it's set to null
 
6:42 PM
yup
 
Wes
do you think it can be done without hoisting?
that would be amazing
 
what do you mean by hoisting here?
 
Wes
evaluating var $var = 12; before anything else
 
that shouldn't be necessary
From an implementation perspective, I'd expect it to work something like this
Each var variable gets a new CV (slot in the stack frame) -- same as variables do now. Only difference would be that there might be multiple CVs with the same "name", because one var can shadow another.
The second part would be that whenever a code block ends, we'd perform an unset() of the variable. This would also have to be integrated with exception unwinding.
Things like get_defined_vars() would probably have to figure out which variable is active right now, if there are multiple with the same name
There's probably also some issues around goto
Because you can jump in and out of a "scope" of a variable, and I'm not really sure how that should work
Goto might be the main problem from a "semantics" perspective
 
Wes
can you initially disallow to use declared variables and goto at the same time?
i don't think anybody will care, implementing it would be just a badassery demonstration :B
 
6:50 PM
most likely it's not even a problem ... just something you can shoot yourself in the foot with, but goto is known for that anyway ;)
 
Wes
:B do you think we can support lexical scope in anon classes straight away?
 
How would that look like?
 
Wes
not sure, but anything that makes sense and doesn't force me to write __constructs
function bar(){
    var $hello = 123;
    return new class(){
        public function baz(){
            return $hello;
        }
    }
}
 
@Wes That seems entirely unrelated ... and a lot more problematic
 
Wes
function bar(){
    var $hello = 123;
    return new class(){
        public $hello = $hello;
        public function baz(){
            return $this->hello; // differs from $hello
        }
    }
}
 
6:54 PM
@Wes That looks better...
 
Wes
ideally, both should work
but i don't mind having the second one only
seems cleaner also, somehow
that should only work with anonymous classes. regular classes should not be able to import global variables
i mean people will surely try to do that :B
will it help if i write some tests?
there's one use case we need to cover which is require wrapped in a closure intentionally, to "clean the variables table"
static (function($__FILE__){ require $__FILE__; })($file);
means we might want to provide a way to undo the automatic import
or maybe add a "parameter" to require so that it uses a clean scope rather than the host's
eval might have similar needs
i think lexical scoping is great, but if it spans multiple files, it's gonna suck
variables must not be defined in other files
cc @PeeHaa
 
 
3 hours later…
9:54 PM
@Wes why the var keyword? I don't mean why var specifically, rather why the keyword at all? What's the difference in the decl? For that specific example it would be annoying if this didn't work:
function bar($hello){
    return new class(){
        public $hello = $hello;
    }
}
 
Wes
@NikiC ^ there is the problem with parameters
function bar(var Foo $hello){}
 
function bar($hello){
    return new class(){
        public $hello = use $hello;
    }
}
might be a different approach maybe ^ ?
 
Wes
@DaveRandom because non declared variables must continue to work as usual
it would be a big break if suddenly a variable created in a for() would not be available outside that for()
function bar(var Foo $hello){} <- this is horrible
and that's a big problem
 
What I don't like is that it has the opposite semantics to closure use(), I'd prefer something like either what I did there or new class() use($hello) so the vars are explicitly imported, rather than inheriting things based on the way they were declared
really should stop using the word "closure" there as well, since this is precisely the way in which PHP anon functions aren't actually closures
new class() use($hello) is probably the most best option in terms of consistency
 
Wes
dave, the problem we are trying to solve is precisely avoiding to write use(), that or in any other form
 
10:03 PM
don't see why it's any different tbh, the difference is only IoC semantics
In other words, I don't I don't like the idea of having the way the var is declared affect the way it can be used in code that may be a long way away from the decl
 
Wes
ithe difference is that if you have variables, you most likely want to do something variables, as opposed to not doing anything with variables. therefore defaulting to a whitelist is a horrible idea
tbh i am tired of explaining why that's important
 
public $foo = use $foo; seems no different, anyway. It's still just a 3 letter keyword, only in a different (more logical, to me) place
@Wes I do understand the desire not to have what's essentially a superfluous arg list
and actually I would argue that having the var decl is actually exactly a declarative whitelist, whereas that ^ is more like an "import", which is what you are actually doing
 
Wes
$foo = 123;
function(){
    $foo = use $foo;
    return function(){
        return use $foo;
    };
};
 
although in some regards I'd rather have a more general syntax sugar for ctors where you can inline the property decl with the ctor signature, that way it would work with named classes as well
@Wes I think (in theory) the intermediate import could be skipped, if you are talking about lexical scoping
the problem with lexical scoping is that it's a minefield of potential dumb mistakes no matter what you do...
 
Wes
on the mailing list i keep reading very prominent php figures not really having a clue about this kinda paradigms
that really makes me depressed
 
10:12 PM
I think a lot of people have been burned by the semantics of var in JS as well
 
There's a way to define a variable inside Class_A, and on Class_B extends Class_A to be able to use the variables from Class_A? Like this: pastebin.com/raw/bDVzSSg2 If on Class_A i do `protected $test = 'value'; i would be able to do that, but i can't because the value from the variables comes from the database and will have diferent values depending on the page i'm at.
 
Wes
dave, you are a smart person
you can't think var was hard semantics
 
no I don't, at all
 
Wes
sure, let is better because it doesn't require you to do iifes in loops
but you could live with it, i mean
 
@Wes no, but in JS it's muddy, only because of old mistakes (people not decalring vars and then having them be unexpectedly global) but people have long memories
@Wes I was actually going to suggest that using let would be better (assuming that can be done in a BC way) specifically because of that... I know full well that the keyword is irrelevant, it's just a marker, but people see var and they think about the bad old days of JS and PHP4
is var still a reserved word in PHP?
 
Wes
10:17 PM
yes it is
var in php would be like let in js anyway
 
@DerpDeeDerp inheritance is nothing to do with where the values are coming from
you have two classes, not two objects
@Wes yes and no, it (presumably) wouldn't be block scoped?
 
Wes
it would be block scoped yes
foreach($users as var $user){

}
 
in that case I really would prefer let, and I will freely admit that is solely because of JS, but at the end of the day PHP and JS are quite closely related in terms of the people who are using them
 
Wes
i am saying would be, because we were talking specifically about implementing that :B
 
I'm not against it but I'm also not sure whether it's necessary (I don't need persuading, I just need to think about it more)
 
Wes
10:23 PM
dave, please, it is necessary
 
Sure, I have wished PHP had block scoping on numerous occasions
 
Wes
but, it doesn't cost me anything developing the thing you proposed
 
and I like the idea of that being declaratively controlled as well
for me, this is two separate things which are completely independent though... block scoping and lexical scoping I mean
 
Wes
you suggested this:
$var = 123;

$abc = function(){
    return (use $var) * 10;
};
i suggest this
 
like, lexical scoping still works without it, and block scoping is still useful without it
 
Wes
10:26 PM
$var = 123;

$abc = function(){
    return $^var * 10;
};
both as equivalent to:

$var = 123;

$abc = function() use($var){
    return $var * 10;
};
 
yeh I actually considered precisely that, ^ makes sense but it looks a bit horrible
I wondered about $#var
(since # often signifies identifiers)
I would really like to deprecate perl-style comments...
I'm not against a sigil instead of a keyword though, in general
 
Wes
i use ^ because "super"
 
as long as it's obvious
@Wes yeh it was my first though as well but it's displeasing to the eye for some reason
maybe $>var?
> is sort of "import"
 
Wes
$var = 123;

$abc = function(){
    $var = $^var; // still needed though
    return function(){
        return $^var * 10;
    };
};
unless
$var = 123;

$abc = function(){
    return function(){
        return $^^var * 10;
    };
};
rofl
 
whatever, this is somewhat bike shedding, it's only affects the lexer
 
cmb
10:30 PM
have you considered to put the sigils before the $var?
 
implement something, this would be a fairly minor change
go with $^ if that's your preference
 
Wes
i mean accessing a var from two function scopes up, not one. check my last two bits of code
 
@cmb the problem is that there's almost nothing that wouldn't be ambiguous with an operator
(and yes, I did ^ :-P)
I don't think it would be actually ambiguous but I think that it might be hard to persuade bison of that fact, more accurately
 
cmb
ok. Still I think breaking $var is bad for readability/grepability.
 
agreed
I actually think that public $foo = use($bar) is the best option (with or without parens, don't care)
 
Wes
10:33 PM
^$var or $var^ surely are not lexer friendly
 
but I'm more interested in @Wes implementing something and we can fight about this later :-P
these are all essentially just lexer variations afaict
 
Wes
i can't implement anything, i can only develop ideas :B
 
I call bullshit, yo :-P
 
Wes
did you read my last example
 
I'm not expecting it polished but I reckon you could totally make a PoC
 
Wes
10:35 PM
if i am nesting closures, i still need to do $foo = use $foo;
 
why? it's lexical...
it's just "get me the nearest symbol named this"
doesn't necessarily need to be the direct parent block
unless I'm missing something?
 
Wes
possibly, surely that's going to be a mess though
 
it's still done at compile time, it will only work with explicitly referenced symbols
 
Wes
$abc = function(){
    $baz = ^::$var;
    return function(){
        return ^::$baz * 10;
    };
};
like this but shorter

$abc = function(){
    $baz = super::$var;
    return function(){
        return super::$baz * 10;
    };
};
 
oooh, I hate that but :: is interesting
 
Wes
10:38 PM
^::$var is not bad tbh
 
I disagree :-P
I would expect lexical scoping to be independent of nesting
I'm not aware of a language where that isn't the case, although I could be wrong about that
 
Wes
<?php

$ob = function(){
    return function(){
        return function(){
            return ::&$bar * 100;
        };
    };
};


$bar = 5;

assert( $ob()()() === 500 );
i like it, i mean i would prefer "let" but this is certainly an option
if you don't mind i'd write another rfc, of course i'd credit you for the idea
 
Like, I wouldn't expect these two to behave differently, which seems to be implied by what you are suggesting:
if ($foo) return new class() { public $foo = $^foo; };

if ($foo) {
    return new class() { public $foo = $^foo; };
}
 
Wes
no they would work the same, obvs
if without curls counts as a block anyway
 
I don't hate the bare ::$foo
It is the "scope resolution operator" after all, which is precisely what you are doing
 
Wes
10:45 PM
/me proceeds writing the rfc. will link to you before i announce it obvs
 
don't announce before PoC impl
 
Wes
^ is to be avoided, for me :B
 
which I think i could do
 
Wes
because i realized it's hard to write $^baz
::$baz is much simpler
 
might need a little bit of help but not loads, I have a basic idea of what would need to be done and where
@Wes for me it's about legibility, and that is a thing which reads logically to me
 
Wes
10:47 PM
are we sure ::$baz is actually feasible though
 
I don't see why not, can't think of a scenario where there would be any kind of ambiguity
 
Wes
it should be
yes i can't either
 
it should be read-only though, IMO
i.e. ::$foo = 1 shouldn't be possible
at least initially, and personally I think forever
 
Wes
@DaveRandom no
i want to die
 
too many questions and edge-cases w.r.t scopes that no longer exist
oh actually no
it's basically just a ref
yeh forget that
so implementation wise, I'm thinking these are essentially just going to be private properties with references @Wes, they have identical semantics unless I'm missing something
what should unset(::$foo) do though?
 
Wes
10:54 PM
you mean unset(::$foo) or unset(::&$foo) ?
unsetting variables is something you shouldn't be doing anyway, so i don't care
 
show me a scenario where ::$foo and ::&$foo are functionally different? (not one involving unset())
 
Wes
hold on
@DaveRandom 3v4l.org/bu9dM
and obviously, use(&$use) can also write to it, and affect the parent scope
 
@Wes sure, but writability implies reference
i.e. ::$foo = 456; has no effect unless it's a reference to the original zval
 
Wes
yes that has no effect, only ::&$foo = 456; has
means that ::$foo = 456; should throw
right?
 
hmmm, that's leaky
@Wes compile error
actually wait
I think there are two options here, at least with regard to simplicity of the initial impl:
a) Everything is implicitly by-ref
b) Everything is by-val and writes are not allowed
::&$foo = 1; feels wrong
(having the ref on the lhs I mean)
 
Wes
11:04 PM
a) would be great for me
since it's not an import
means that you can have ::$foo and $foo at the same time
 
I think that's the only thing that makes sense with lexical scoping tbh
you can still do $local =& ::$foo; if you want to store a ref
for me, the point of lexical scoping is that the vars are "shared" between the scopes, which sort of implies by-ref semantics
imho, ymmv, etc etc
ftr it also makes the implementation simpler :-P (I think)
 
Wes
there's another thing
 
because it means it essentially just becomes syntax sugar for by-ref imports into private properties
 
Wes
function(){
   // tons of code here
   echo ::$foo * 39;
}
::$foo is bound at compile time, not at invocation time
like function() use($foo){
 
sure, but that's necessary anyway, otherwise you'd have to walk the stack and interrogate the symbol table in every frame for every usage
 
Wes
11:09 PM
except that's deep down in the code
i intended that to be by value
 
33 mins ago, by DaveRandom
it's still done at compile time, it will only work with explicitly referenced symbols
 
Wes
sorry i am bit lost
i am saying that ::$foo defaulting to by value doesn't make sense
the variable is resolved, not a reference
 
yeh I get you
hmm yeh
ugh
I think your original suggestion of ::&$foo might be the only way, it just feels wrong though
 
Wes
no
if ::$foo was by value
then ::$foo = 123; would've to be disallowed, because basically you'd be modifying a local variable accessible through the syntax "::$foo" which has nothing to do with the $foo in the outer scope
that's a bit shit
so imho it's better if it's by ref
basically like variable scoping in all jvm languages
like python
js
and possibly other languages i don't know :B
i don't know why people can't fathom the fact that sometimes you also want to write to a variable :B
 
the problem is something like this:
function gen()
{
    for ($i = 0; $i < 5; $i++) {
        yield function($j) { return ::$i * $j; };
    }
}
$arr = iterator_to_array(gen());
// later...
$arr[0](1); // returns 5
if everything is by-ref, that would be an unintuitive consequence
 
Wes
11:17 PM
they do use oop like containers all the time
$this->addStuff($here);
$stuff = $here->getAddedStuff();
but they are unwilling to do the same thing with variables :\
 
I think that if you want writes to work then it would need explicit references to be declared somehow
 
Wes
but why?
 
because you can't have implicit refs always as it makes it a lot less useful for stuff like that, and you can't make it writable if it's by-val
and you can't have some magical thing that makes it auto-by-ref if there's a write and by-val otherwise, because that also would limit the usefulness and would be leaky af (e.g. you couldn't detect when it was passed to a by-ref arg of a function called from the inner scope)
if you want writability, it needs to be explicitly different in some way
unless you have a trick up your sleeve that I am missing, ofc...
brb 5 min
 
Wes
11:35 PM
stuff like that = what stuff?
 
oh sorry, my last code sample
it's the exact problem that makes that horrible "anon function factory" paradigm necessary in JS
 
Wes
yes, that's why let exists :B
but that isn't a good reason to default to by value
 
pretty sure that has the same issue but "let" me double check that :-P
 
Wes
let fns = [];

for(let i = 0; i < 10; i++){
    fns.push(() => {
        console.log(i);
    });
}

for(let fn of fns){
    fn();
}
makes sense?
if you replace "let i" with "var i" you are gonna get all 10s logged
 
til
 
Wes
11:42 PM
that's the only reason let is useful tho :B
 
actually yes I already knew that, I just went momentarily insane
right
 
Wes
because otherwise what let does is either irrelevant or identical to what var does
 
my issue with that approach though is that the behaviour is controlled by something which could be a long way from the actual usage
which is what I want to avoid
I want to be able to know how it's going to behave by reading only the line of code where it's used
(which your original, albeit somewhat ugly, suggestion of ::&$foo vs ::$foo accomplishes)
like in JS I don't like the fact that you need to go and check whether the imported var is declared with let or var in order to know how it's going to behave
 
Wes
nobody uses "var" anymore
 
no, but legacy code is a thing :-P
 
Wes
11:48 PM
okay but it's no different from use()
 
indeed, but my point is that ::$foo and ::&$foo disambiguates it in a way that will be universal and holds all the information about semantic in one place
also, I haven't seen you suggest an alternative yet :-P
(assuming you want to be able to have both by-ref and by-val as options)
if we just pick one or the other then the problem goes away, obviously
 
Wes
@DaveRandom my suggestion (levi's, not strauss, actually) is having just "let" like in js
 
ok, which means it will behave as by-val and the default is by-ref?
that's the opposite of the way everything in PHP works atm
I don't necessarily dislike it but there will be a lot of resistance to that
also it does mean that you couldn't use both the original value and the current value without making a copy, although that's not necessarily a problem
i.e. you couldn't do this:
 
Wes
means it will behave only by ref, since control structures would work like in js
<?php

var $fns = [];

for(var $i = 0; $i < 10; $i++){
    $fns[] = function(){
        var_dump($i);
    });
}

foreach($fns as var $fn){
    fn(); // 0 1 2 3 4 5 6 7 8 9 10
}
 
that's by-val
 
Wes
11:55 PM
no it's by ref
 
$i is by-val
 
Wes
dude.
 
am I being dumb? surely if $i was by-ref they would all be 10?
by the time you call the first function $i == 10, surely?
what am I missing?
 
a bedtime?
 
Wes
the scope of the i in

for(let i = 0; i < 10; i++){
      // is the single execution of the for() body
}
 
11:58 PM
@Danack true but irrelevant, I need to wait for this data import to finish before I sleep
got a solid hour left :-/
 
Wes
basically, this
for(let i = 0; i < 10; i++){

}
is equivalent to this
for(var i = 0; i < 10; i++){
    (function(i){

    })(i);
}
 
right, which makes $i by-val...
 

« first day (3172 days earlier)      last day (1767 days later) »