« first day (2244 days earlier)      last day (2704 days later) » 

9:00 PM
@Alesana Yeah, it's a bit more pop-ish than his other stuff. You might like Master of Darkness though. Based on Star Wars :P
 
@Tiffany I will check it out! You ever heard of Tool?
 
I hope she's heard of Tool
she's gonna lose points in my book if she hasn't :/
 
Anonymous
Hah, Bruno Mars sang his new song 'Chunky' at Victoria's Secret :troll:
 
Hah.. I used to live in the US and everyone had heard of them.. now I moved to Argentina and it's unheard of :|
 
Yes, I was listening to Tool when I was ten.
 
9:04 PM
Anyone use notepad++?
 
Yes
 
Do you use the FTP plugin?
 
I do not, sorry.
 
NppFTP?
:| It fails on the upload maybe 25% of the time
 
ThW
People still use FTP?
 
9:06 PM
@ThW what else do you use?
 
@rabbitguy @ThW SCP/SFTP?
 
ThW
sftp/scp
actually git, deployment is done automatically
 
What do you think git uses? :P
 
midgets?
 
ThW
developer point of view
 
9:08 PM
s/automatically/automagically
 
Oompa Lumpas
 
close enough
 
ThW
I use git to push the source, the deployment is another domain/view and mostly uses sftp/scp
 
They had a discount on 'em becase they wouldn't stop singing
 
lol
 
9:10 PM
@ThW The FTP plugin for Notepad++ can use sftp
 
netbeans ftw!
 
ThW
@Alesana Yeah, but I don't deploy from the IDE/Editor. I commit/push into a VCS.
 
phpstorm ftw
 
lol
qbasic ftw?
 
@Thw I understand that but to say "People still use FTP?" when what you use, uses FTP, is a bit odd in my opinion
 
ThW
9:13 PM
I don't use FTP anywhere
 
@bwoebi Wouldn't it be great if:
return \Amp\pipe($promise, () => $this->doAction());
 
Should I define $array = array(); before pushing an element to an array $array[] = $string; or is it okay to define it and push an element to it at the same time?
 
anything which transfers my file is ok for me ATP BTP CTP
 
@LeviMorrison sure
 
ThW
9:15 PM
@Alesana $array = ['element']
 
@Alesana If you know the element you want to push at the time you create the array
 
Remind me why we can't have nice things again? Oh, right, I haven't made the nice things RFCs yet.
 
There's no problem initializing the array with the element
 
@ThW I am only pushing elements in a foreach loop so, I think, that would redefine it each time
 
@Alesana Right, so you need to initialize the array before the loop
As an empty one
 
ThW
9:16 PM
@Alesana In this case you should initialize it as an empty array
 
$arr = [];
while (someLoop()) {
  $arr[] = 'whatever';
}
 
Great thanks!
 
But don't do this
 
ThW
$array[] = ... is a modification of an existing variable
 
not $arr = array();?
 
9:17 PM
$arr = []
$arr[] = 'whatever';
In this case, just $arr = ['whatever']
@Alesana What PHP version are you using?
 
Ahh yeah that makes sense
 
ThW
@Alesana old vs new syntax
 
7, but I am scripting something I want to be able to be used on 5
 
@Alesana [] is 5.4
And it's exactly the same as array() just shorter and doesn't look like a mutated function.
 
Ah great, thank you
 
ThW
9:18 PM
@MadaraUchiha for the most cases, some are 7.1
 
@ThW the [] syntax is available since 5.4
 
ThW
true, extended for 7.1 (list replacments)
 
@Alesana May I remind you that 5.6 support basically is going to end in 24 days?
 
9:19 PM
@ThW Oh, destructuring
[$a, $b] = [1, 2];
 
ThW
yeah, really cool
 
@ThW Indeed, JS has it too since ES2015
 
Wes
@bwoebi really? AHAH
 
Does it have a short syntax for associative arrays?
Like, in JS, you can do this:
 
9:21 PM
@Wes Well, "broke"… It makes the Receivers appear on the same line than the title, without spacing in between
 
const obj = { a: 'foo', b: 'bar', c: 'baz' }

const {a, c} = foo;

console.log(a, c); // 'foo', 'baz'
 
@PeeHaa Thanks! I just want my script to be used by as many people as possible :)
 
How would that look like in PHP @ThW?
 
Wes
@MadaraUchiha [$a, $c] = $foo; ?
 
ThW
$data = ['a'=> 'foo', 'b' => 'bar', 'c' => 'baz'];

['a' => $a, 'c' => $c] = $data;

var_dump($a, $c);
 
9:28 PM
@ThW Ah, so no shorthand for that case
 
ThW
?
 
Shame that enables some pretty awesome stuff
I don't need to do {a: a, c: c} in JS
Just {a, c}
 
ThW
actually I like the PHP variant,
more explicit
 
@MadaraUchiha that's similar to our syntax for accessing [0] and [1]
 
ThW
no dependency between the array key and the variable name
 
9:29 PM
$data = [1, 2, 3];
[$a, $b] = $data;
 
@bwoebi Right, but since JS differentiates between arrays and objects (what PHP calls associative arrays), I can do both
 
for us it saves 0 =>, 1 => @MadaraUchiha
 
let [a,,c] = [0, 1, 2]
That works in JS
 
ThW
that works in PHP as well
 
@MadaraUchiha you mean since JS?
 
9:30 PM
@ThW Right
But the associative version doesn't
@bwoebi Yeah
In JS, I can do this (which is my single favorite usecase for destructuring):
 
ThW
what would you do if the array key and the variable name have to be different?
 
function foo({foo, bar, baz}) {
  // use foo bar and baz here
}

foo({foo: "a", bar: "b", baz: "c"});
@ThW then you have the extended syntax like
 
@MadaraUchiha I wish I could too
 
Wes
array oriented programming @MadaraUchiha :B
 
const {foo: a, bar: b} = {foo: "whatever", bar: "whatever"};
// use a and b here
 
ThW
9:33 PM
ahh ok
 
JS also got a short object syntax, if the key and the variable holding the value have the same name, you can do this:
var foo = "whatever", bar = "whatever";

foo({foo, bar}); // equivalent to foo({foo: foo, bar: bar})
 
ThW
weird
 
@MadaraUchiha I wish I could use that in PHP, but it looks TBH a bit too much magic … so I probably would vote no on such a RFC
 
So you get free objectified arguments (with irrelevant order), and you call them almost like you call a function without the object argument.
 
@MadaraUchiha wait wat
 
ThW
9:35 PM
@bwoebi yes, looks like the caller has to much control over the handling
 
@PeeHaa Actually that call is impossible since foo is a string
But the idea is the short object syntax
@bwoebi Well, that wouldn't work as well in PHP because PHP doesn't differentiate between arrays and associative arrays the way JS does with arrays and objects
Also, PHP associative array keys must be quotes strings, JS ones do not.
They can be symbols
(both values of the Symbol type, and interned symbols used for variables)
So it doesn't look as magical in JS
It would look weird on PHP though
 
ThW
s/can/must
 
@ThW No
 
@MadaraUchiha even if it would, due to a special syntax
 
ThW
symbols or literals
 
9:37 PM
const obj = {"foo": "a"}
@ThW const obj = {["not" + "literal!"]: "hello"};
 
[=> $foo, => $bar] = $data; (let in this example be => the indicator that array key name == var name) @MadaraUchiha … would be quite weird too IMHO
 
@bwoebi Yeah, it would look out of place.
 
ThW
literal expression
 
"not" + "literal!" isn't a literal expression
For that matter, this works too
 
ThW
in php it depends if you declare the array or initialize it
 
9:38 PM
@MadaraUchiha It's a constant expression though
 
const value = "not";
const obj = {[value + "literal"]: "hello"}
Object keys can definitely be dynamic runtime values, as long as they're either typeof 'string' or typeof 'symbol'
 
ThW
declaration only allows for literals/literal expressions, initialization for anything
 
@ThW Not since ES2015.
const fun = Math.random();
console.log({[fun]: "yey!"});
Try that in your console :P
 
ThW
ohh interesting
 
Think of it this way
This was always possible:
 
const fun = Math.random();
let obj = {};
obj[fun] = "yey!";
This just makes it shorter, is all.
 
ThW
yes
 
ES2015 took pretty much all the pains I had with JS and applied treatment one way or another.
 
ThW
browser support?
 
@ThW Fairly good
And Babel for the rest.
 
ThW
9:42 PM
urgs 'Babel' is a terrible name to search for
 
@ThW babel js
 
hi babes
 
ThW
found it
 
@ThW Give the playground/repl a try
Try the examples I posted here
 
ThW
bookmarked
I do mostly vanilla js
 
9:44 PM
it is kinda "vanilla js", but just a bit more modern
it's kinda php 5.3 vs php 7.1
 
@tereško Right, only with a lot more sugar.
 
that kinda depends on how you look at PHP7
 
Also, does PHP have something similar to this in the new list shorthand?:
 
I'm Fairly tired :(
 
function tail(array) {
  const [head, ...rest] = array;
  return rest;
}
(equivalent to slice(1))
 
yup
 
it's fascinating
 
@MadaraUchiha aka array_shift() in PHP
 
ThW
my brother studied mathematics, he speaks a different language :-P
 
@bwoebi I meant the const [head, ...rest] thing
You take a few variables off the first elements, and jam the rest in to a variable.
Is that possible (and without mutating the original array?)
 
@MadaraUchiha I believe @Wes wanted to RFC something such
 
Wes
i did
 
Seems legit.
@bwoebi The thing that makes destructuring, rest and spread operators work so well in JS, is that they work together, anywhere.
 
@MadaraUchiha otherwise, $rest = $array; [$foo, $bar] = array_splice($rest, 0, 2);
 
Wes
i need to find the strength to explain in the best way possible why it should work the way i think it should work :B
 
9:53 PM
@PeeHaa divide by zero -> the world of imaginary numbers.
 
You can spread into an array, or into a function call (like PHP's splat operator), you can destructure function arguments, or variables, or return values, etc.
@bwoebi Right, but it's not as fancy :P
 
> Trump to name Scott Pruitt, Oklahoma attorney general suing EPA on climate change, to head the EPA
that
 
@Wes How do you think it should work?
@Tiffany Not really, that's divide by sqrt(-1)
divide by 0 = undefined
 
Wes
too tired to explain it now :B
 
@MadaraUchiha that's right. It's been awhile since I've had math >.>
 
9:55 PM
@Wes Spoken like a true Italian.
 
:D
 
@MadaraUchiha how does the splat work with dicts? (if key already exists)
 
@bwoebi Later overrides former
Also, object spread is the only one that's not yet entered the specification
But Babel supports it, so pretty much everyone are already using it.
 
@MadaraUchiha Good, now consider that PHP mixes integers and string keys. If you splat integer keys… shall they append? override?
 
@bwoebi If you actually specify the integer key, I'd expect it to override, yes
If you didn't, probably append
How does ordering go in PHP in such mixed arrays, by the way?
 
9:57 PM
what is "splat integer keys"?
 
@MadaraUchiha actually it's just sqrt(-1) to get imaginary numbers... you don't have to divide by it
 
@MadaraUchiha specified where?
 
$arr = [0, 1, 2, "a" => "b", "b" => "a", 3, 4];
 
@MadaraUchiha ordering is not dependent on the keys in general… it is depending on order of insertion.
 
@bwoebi As in, if you tried to spread [0 => 3] into [0, 1, 2] I'd expect the result to be [3, 1, 2]
(is that even possible?)
 
9:58 PM
@MadaraUchiha [3] and [0 => 3] are semantically equivalent, so no.
 
Not in this case, at least.
In this particular case, a distinction is made.
To be fair, JS has it easy because arrays are so disgusting.
In JS, all object keys are strings (or symbols, but mostly strings)
Including arrays numeric indices
 
Inside [0, 1, 2, 0 => 3] yeah
 

« first day (2244 days earlier)      last day (2704 days later) »