« first day (2972 days earlier)      last day (2201 days later) » 

16:00
@tereško Of course, just like Java code doesn't look like PHP code, even though they are vastly more similar than PHP to JavaScript.
I was reading some javascript code a few weeks ago that had constructors and classes
I thought I was in the Twilight Zone
@ircmaxell JavaScript objects don't take their "blueprint" from classes, they take their "blueprint" from other objects (a.k.a. the prototype)
that's because they don't separate at the usage level the static and normal methods
if they were, you would see :: everywhere
If you're thinking of the class keyword, that's just sugar for a constructor function with a few extra limitations (like making sure you can't invoke it without new)
@tereško exactly
16:02
@MadaraUchiha even if it is, it's a good thing. A C/C++/Java/C# developer coming to Javascript will feel more familiar.
It makes Javascript more accessible.
@Tiffany Oh, for sure. That's not the argument though
There's no language level concept of a class, even though there's a class keyword
@Tiffany sure, but that'll still not be like how it is in those languages
@mega6382 They don't think it be like it is but it do
@MadaraUchiha how bout in TS?
@mega6382 TypeScript does have the concept of a class, it has a meaning further than just an object factory when I create a class (it adds a type, I can pass the class around and TypeScript will know it's not a normal function, etc).
16:05
@MadaraUchiha And what is a prototype if not a form of class
The TypeScript compiler will not let me call it without new even though the runtime would let me (assuming it compiles down to a constructor function, if my target is ES5 or ES3)
@ircmaxell sorta-kinda, it conceptually fulfills the same objective, but it falls differently in the layers of abstraction in my eyes
A class gives you certain guarantees (for example, that all objects created from it will have all of the methods and properties defined on it for the entire lifetime of the class), which an object equivalent does not guarantee
Also, in JavaScript, I can create an object without a prototype
const x = Object.crate(null);
I didn't say it's identical with a PHP/Java notion of a "class". But it's functionally incredibly similar, especially when you look at classes in languages like Smalltalk
@Tiffany @tereško do you know Engineering Eternity's videos on youtube? They're like, amazing
#PoE
@ircmaxell When you ignore certain abilities (which, admittedly, most of us in JS do, you don't see much modern code that overrides prototypes past the first tick), then yes.
@FélixGagnon-Grenier I have not gone that deep in PoE
16:08
@MadaraUchiha Also, there is no such thing as interfaces in js
@MadaraUchiha Are those abilities core to what a class provides?
@tereško It kinda sparked an interest for me. It's quite technical
Example: Inheritance isn't core to what a class is / provides. But many people feel it is and assume it must be
here is a Path of Exile review for you :D
look at this creating a build video, if you have the time ;) youtube.com/watch?v=9i2o2wW7xbQ
@tereško ok that's amazing
16:12
@ircmaxell No, but they violate the promises that classes give you
what promises?
@ircmaxell like inheritance and whatnot, i think
@ircmaxell For example, that it's an accurate blueprint for an object.
@tereško actually... that escalated wildly
:D
watch his Rimworld review
16:18
Also @ircmaxell those classes and the classes described in the video are not the same.
@MadaraUchiha A class doesn't promise that it's an accurate blueprint for an object in Java or PHP
@ircmaxell Oh? Counter-example?
it promises it's a blueprint, but the implementations, constraints, and details can change by extension
be back in a sec, short meeting ^^"
class A {
    public function add(int $a, int $b) : int { return $a + $b; }
}
class B extends A {
    public function add(int $a, int $b) : int { if ($a > 1) throw new Exception('...'); }
take a look at Ruby for a better view of the middle ground that connects the two
16:22
@ircmaxell How is it not an accurate blueprint? If you do new A() you get an object matching the A blueprint, and if you do new B() you get an object matching the B blueprint.
and then you do $a->foo = 42 and its no longer accurate :)
but B does not represent an accurate blueprint from A
and that's the point
@ircmaxell But I didn't instantiate A, I instantiated B
$foo instanceof A doesn't tell you that A's blueprint is unchanged
I'd argue that has nothing to do with classes, but with PHP's non-dynamic object model
You can have both, simply look at Ruby
One does not simply look at Ruby. It hurts the eyes.
3
16:27
@ircmaxell Perhaps, but recall that I can do all of this without using a prototype either
1, 2, 3, 4, 5, 6 - this number is growing linearly.
1, 2, 4, 16, 256 - this number is growing exponentially.
1!, 2!, 3!, 4!, 5!, 6!, 7! - this numbers is growing 'factorially'.

Is that a word or is there an actual phrase for that growth pattern?
With just object literals.
Wes
Wes
@Danack on google i can only find "factorial growth"
Also, still, just because you can think of them as classes, and they kinda-sorta fulfill the same purposes, does not mean that you have classes in the language
@Danack As far as I know they're both valid but only British people say "learnt" or "spilt".
16:31
@MadaraUchiha true, but prototypes are a form of "class" as well, almost identical (except in runtime resolution) to Ruby's class system. The only reason JS is thought to "not have classes" is because people see the class construct and think it's a class. but there are subtle differences
And even then in my experience it's only a handful that use those.
I can also claim in this case, that a simple function in PHP which returns an stdclass to be a class.
@MadaraUchiha Also another ridiculous thing in JS
function foo(){}
new foo();
@Allenph I think I'm going to start using them wherever possible then.
So everyone knows you're British?
16:32
> people see the class construct and think it's a class
@ircmaxell I didn't get that one, could you rephrase?
@mega6382 Meh, it's not even close to "ridiculous", really.
people see the class keyword, and make all sorts of assumptions about what that means. And they see the lack of it and make a whole bunch of assumptions about that as well
Take a look at with, and while you're at it, think on variable variables in PHP.
@ircmaxell Hmm, sure. One of the arguments against adding the class keyword to begin with was that people will assume things without understanding that it's still prototypal under the surface.
@Allenph More so people are discombobulated and can't tell if I'm actually speaking English or am just making up words.
precisely
@Danack Be careful. "Learnt" is associated with hillbillies in the US.
16:36
@Allenph Learnedt*
@MadaraUchiha So, its not really a class, its prototype, then why is @ircmaxell saying that prototypes are classes
Wes
Wes
hey irc \o
@mega6382 I can agree with them being "conceptually like classes",
But it's not a class in the sense that it's its own concept
At least, not from the language's perspective.
@MadaraUchiha You'd be surprised. When I graduated high school I overheard someone introducing their favorite teacher (FFA teacher) to their parents. I heard them say, "I'm so glad Mr. **** was here to learnt me."
For that matter, there's a very little practical difference between a constructor function that you invoke with new, and just a regular ol' function that returns an object literal, that you invoke by calling normally.
16:38
My argument is, if you look at the popular languages that use classes, and look at the commonalities between them, prototypes fit that definition.
Prototypes only aren't classes if you limit yourself to Java/PHP-esq classes (C++ to some extent included)
class Foo {
  constructor() {
    this.x = 42;
  }

  getX() {
    return this.x;
  }
}

// vs

function Foo() {
  return {
    x: 42,
    getX: function() { return this.x; }
  }
}

// very little actual difference in the end.
@MadaraUchiha thus proving my point
48 mins ago, by mega6382
JS/TS are crazy languages
@mega6382 Have you worked with any Lispy language?
Nope, don't think so
The reason JS seems so odd is that it's (almost) a Lisp-like language with C-like syntax, that's designed to look like Java.
2
However, that fact that we've (collectively, as a community) managed to make JS into a relatively orderly and sane language (the sanity of which is further augmented by TypeScript), is nothing short of a miracle in my eyes.
Watching the transformation from a "script kiddies" and "make the cursor sparkle" language into an actual real thing was a pretty fun experience to have.
16:45
@MadaraUchiha Well there was no alternative with it being the only frontend language
@mega6382 Not true at all.
How do you mean?
You have plenty of languages with JavaScript as their compilation target.
TypeScript, Kotlin, ClojureScript, to name a few.
@MadaraUchiha but its not the same thing
Why not?
16:46
The end result is always JavaScript
(That's not even considering the implications of WASM)
@mega6382 No, the end result is always machine code
JavaScript is simply yet another intermediary.
@MadaraUchiha :D
Why do you care if JavaScript is a target?
The original complaint is that there are not other source languages that can be used for web development
@MadaraUchiha WASM will also only compliment JS, it will not be a replacement or anything
Which used to be a valid complaint, but today?
@mega6382 What makes you say that?
16:47
@MadaraUchiha Because there is a different level of type safety at runtime vs. compile time.
WASM has access to the DOM and everything.
@Allenph So what? There are plenty of languages where the runtime has no type information while the compiler does.
Java generics are a prime example.
@MadaraUchiha Well, that's why I personally care.
I don't get TypeScript. It's turning a dynamically typed interpreted language into a "strongly typed" (not really but...) compiled language.
> No! WebAssembly is designed to be a complement to, not replacement of, JavaScript. While WebAssembly will, over time, allow many languages to be compiled to the Web, JavaScript has an incredible amount of momentum and will remain the single, privileged (as described above) dynamic language of the Web. Furthermore, it is expected that JavaScript and WebAssembly will be used together in a number of configuration
@Allenph Why? Do you use PHP's type information in runtime when you write PHP?
And I agree with you on the function is the same thing as a constructor thing.
16:49
@Allenph It's exactly that, what's not to get?
@MadaraUchiha There's quite a few places where I do, yeah.
@MadaraUchiha I just don't like it.
@Allenph The type info in runtime? Example?
@MadaraUchiha Switching off of exception types, throwing exceptions when input cannot be correctly cast, etc.
@Allenph How do those manifest in code?
Okay, first of all I'd like to say that I have absolutely no idea what I'm talking about, so I may be saying stuff that doesn't make sense.
Second...what do you mean how do those manifest in the code?
16:54
@Allenph With C#, I have the typeof and nameof operators that allow you to inspect types in runtime without reflection
In C# can you get the name of a class with that or just scalar types like JS?
Even with TypeScript, with a bit of configuration voodoo, I can get some sort of runtime representation of an interface, in runtime.
@Allenph Yes, even (and especially) classes.
Well in JS you can't.
@Allenph Well, JS has no compile time to speak of
Also, while the typeof operator is fairly weak, you still do have instanceof, obj.constructor.name and Array.isArray(), etc.
Also I like having private members, and I believe it's tricky in all prototypical inheritance based languages, and not just JS.
prototypal*?
16:59
@Allenph I like prototypical more, it sounds a bit witty
Plus the whole concept of asking parent instances for values seems to break encapsulation to me. Also weird that you have to have a whole string of parent objects that are actually instantiated in order to use a single child instance.
Also I don't particularly like front end so I'm just in general bias against JS.
@MadaraUchiha This seems like it could get really hairy when you have additional named constructors.
Question regarding website directory structure: is there an argument for using numbers as names for subfolders, which indicate the sublevel of a folder in the URL path?
Is there some school of thought that suggested doing this?
it seems like something that would come out of the Wordpress lot
@Tiffany Example?
sec
 /
  About/
    1/
      History/
        History_1974-1995.html
      Board_of_Trustees.html
      Contact.html
(not actual file names, but just an example)
dammit
I guess a better question is what is 1?
17:13
@Allenph "indicate the sublevel of a folder in the URL path" is what I was told. The intention being to separate files into a folder from other stuff... or something. I'm trying to understand where this vendor picked up this idea...
and explain a better way of doing it... I'm wondering if this practice was started somewhere down the line with Wordpress
> indicate the sublevel of a folder in the URL path
No idea what this means.
let me find another folder for an example...
I picked the quickest one
You mean like having a folder there just to say "I'm one level down of root"?
@Allenph in essence...
That seems really over-complicated and pretty useless to me.
You have that information already by just knowing the URL path.
17:20
I agree. It's convoluted, and during the meeting I was trying to understand why they did this rather than just naming the folders based on the topic, and creating index files inside those folders, with other pages associated with that topic.
If I opened a directory at work and saw numbers as directory names I would probably quit. Haha.
Finding stuff in there must be...amusing.
We're using a push CMS, so what we build inside the CMS, gets pushed to another server as static files which hosts the public website: HTML, CSS, JS, asset files, even PHP files...
From what I understand, there are ways to build dynamic paths, but it's not a true router.
Ouch.
The application is like... software to build a CMS pretty much, and the way the vendor is building the CMS for us to use is... becoming unpleasant and possibly a downgrade from what we have already. It could be designed/structured so much better, but in fairness, we're all new to this product, so they're probably applying what they've done with other clients' sites to this. Which in some cases, they shouldn't.
numbering folders like this is one...
I don't know what is out of scope of our contract with them though, I'm not sure if I can ask them to restructure it.
There might be a way to build a true router, there's one university that has tons of proof-of-concept stuff they've done, like trying to apply some of the MVC ideas to Velocity...
17:40
@Tiffany That looks more complicated than just doing it in whatever wrong way they're already doing it.
@Allenph we can't though. It's a closed-source product.
Huh?
@tereško I cannot tell if they're joking. I'm assuming they're not. Funny comment in feed in reference to using "Feeding a fed horse" rather than "Beating a dead horse." "Feeding an already fed horse actually results in colic, resulting in extreme abdominal pain and the need for invasive surgery and sometimes even death in horses!!"
The application is built in Java, and I can't manipulate the source code, it's closed-source. But I can add programmatic logic with Velocity, to tie parts together. Also there's the option to add PHP/ASP.NET/ColdFusion code, but it'll only be able to work with simple stuff, not full classes .... at least that I've seen ...
@StatikStasis Peta rarely jokes about this stuff, they were pushing the whole "milk is racist" crap several weeks ago
I guess I always hope they have a marketing department that just tries to come up with some of the most absurd campaigns in order to get people to look but are more rational in reality.
18:39
hey @kelunik I can see you have quite a nice progress on AoC, mind sharing your solutions via github, so I can see how other's are approaching the same problems as me
here are the solutions of others in this room yessure, MadaraUchiha, Alesana, me
yeah, thats pretty awesome
Wes
Wes
yield; makes impossible to use the debugger in phpstorm, right?
19:10
@Wes why?
@mega6382 Might do that, yes. :P
Wes
Wes
eh, something's messy
probably more xdebug's fault than phpstorm's
btw, did you try with 7.3? last time i tried, like a couple months ago, it was really bad
19:23
@StatikStasis well, PETA is quite well known for actually killing the animals, that they have "rescued" (google, if you don't believe me)
Mornigns
@Tiffany yeah, I remember that
certificates expired – #77244
Hey guys. I've been experiencing pretty annoying issues with gettext on php7.2. Mostly with updates, reloading the page to see my text changing between new and older versions randomly, etc. What are your thoughts? Should I fix it or just switch to a library? If so, which one?
19:36
@Mauro if I am not mistaken, that is an old issue with the c-binding for gettext - you basically need to reload php-fmp or apache for each update :D
... guess why it's not all that popular among developers
certificates expired – #77245
@tereško I'm using Mac+Valet (nginx) on my dev computer. I seen too many issues around with gettext. Any suggestions for a replacement?
13
A: How to clear php's gettext cache without restart Apache nor change domain?

xiaoyiEvery solution (1, 2, 3) suggests changing the domain to get rid of the cache problem, but this will create lots of out-of-date cache in memory. So I dug into the gnu-gettext source for details on the cache strategy (bindtextdom.c:78.) When bindtextdomain(domain, dirname) is called, it will ch...

these two should help
@tereško Thanks. Both solutions look clever but they avoid cache and are not suitable for production envs.
BTW, I have no problem with restarting the web server whenever I update the files.
The real problem is restarting the server is not really clearling the cache.
Unless I find a reliable way of doing so, I must switch to some other tool.
no?
yeah
either write something on your own OR look at what you can find in packagist
19:47
Yeah, I'm working on an old system that uses php arrays with numeric keys to do the job and was looking for a nice quick replacement so I don't go nuts.
20:14
@Allenph Oh, I don't use those capabilities almost anywhere
While there are a few things that runtime type-information are good for (the most obvious use-case is DI with minimal configuration), it's not something I usually need in a programming language
OT: AoC day 5 was mighty disappointing.
@MadaraUchiha I swear I got the right answer for pt2 but it's not taking it, maybe they are wording it oddly but I didn't have enough time to keep going over it
@Alesana If you've got part one, it's literally just run it 26 times, once for each excluded letter of the alphabet, and see which has the lowest length at the end.
It's usually a nicer twist than just "run it 26 times"
That's what I did :|
It just won't take my answer
You sure it's not something stupid like "you're removing only the first match instead of all of them" kind of thing?
Yeah I've logged string/array throughout the process
20:20
Code?
I'm just gunnu run your code with my input to see if I get the same answer
Mine also takes a long time to computer, over a minute for sure. I remember reading that it shouldn't be over 15 seconds so I might be doing even part 1 a weird way.
Part 1 only takes 3 seconds, part 2 takes maybe 3 minutes, something is not adding up...
@MadaraUchiha no doubt, especially with how I solved it, stupidest code I've ever written.
@Alesana How does your code look like?
Code review time!
20:34
Oh now I'm nervous :P
That is part 1
@Alesana Yeah, I started doing it this way, but I wanted to avoid iterating it
I was thinking of doing substr
And while ($i < strlen($input)) {...}
The way I did it, I reconstructed the string letter by letter, and checked the tip for pairs
ohhh
Now that's clever
The way I did it was just to mute out common sense and go all bananas on it github.com/mega6382/aoc-solutions/blob/master/Day%205/Day5.1.ts
20:39
pastebin.com/raw/a2kS28f5 Here is part 2, now that I'm timing it, it took 10 minutes to compute
It seems like a simple "Do the same thing but do it 26 times" but for some reason it takes a lot longer..
@Alesana Mayhaps the array_diff is taking a long time to complete
Try doing it with string replacement instead.
I did that too, same amount of time
And even preg_replace with the i
@MadaraUchiha How much does your part 2 takes to compute the answer?
It takes like 5 seconds @mega6382
$ time npx ts-node src/day5/part2
<ANSWER REDACTED>
npx ts-node src/day5/part2  1.40s user 0.10s system 103% cpu 1.452 total
20:43
Oh I guess a lot shorter
loving the 103% CPU
My computer loves me so much it gives me 3% extra effort.
@MadaraUchiha Mine takes like 30 secs or so
PhP iS NoT WeBScAlE LoNg LivE NoDE
Ah wait, you wrote yours in TypeScript too :D
Never mind
I want to redo all mine in multiple other languages when I get a chance
20:45
The actual difference is that you guys have multiple runs until you get the same string twice
Whereas I only make one iteration, and recursively clean up the tip whenever I need to
@Alesana I thought you were gonna try kotlin for today's solution
@mega6382 I want to go back and redo them all in kotlin
When I have some time though
I tried to do today's solution last night half drunk and the other half asleep
@Alesana Mine is literally that
letterArray.map(letter => input.replace(new RegExp(letter, 'gi'), ''))
@MadaraUchiha Oh nice. I tried not looking at yours tbh.. gunnu wait until after I complete it lol
20:51
So it is actually faster with str_replace, but still not the same answer as yours
Also, strlen(implode( is redundant when you have count(
I want to try and run your solution
But that would require me to install PHP on this system :D
Yeah I have tried it both ways
I'm just an idiot
Did you get it?
I don't know how it happened, maybe while I was half drunk last night, but I somehow altered my input
Even for part 1, which I didn't touch after getting the right answer
lol
Seems legit
20:58
IDK if copy and pasting the file would have added a return in there or something
Can anyone tell me why am i getting only half the string when using $row = mysqli_fetch_row($result) and printing $row[1] for example ?
21:18
I spent a really long time on that with the right code but the wrong input, I'm really annoyed
@MadaraUchiha DI is seriously bad in JS.
Ssube is working on one though isn't he?
@Allenph It is, but it seems like JS went in a different direction with modules.
Yeah. That seems like a mistake to me.
There's really not much hardcore OO done in JS applications
Case in point: size of node_modules.
21:22
The abstractions are simply different in a lot of the cases, you have a lot more standalone unit-ish functions that do stuff with one another, than you have these large entities that keep lots of state and talk to each other through layers.
@Allenph I've never understood that, why does a package need to have a package that another package already has?
!!uban Gotcha
@tereško I read about that.
@MadaraUchiha The first part is fine. It's the God objects I dont like.
@Alesana I'm not sure it really is that bad...is it?
@Allenph No one does, but OO was never the strong side of primary JS devs.
21:26
@Allenph I'm pretty sure I've seen it like that. It could have been different versions, or something, I haven't looked deeply into it
Like I said, JS is a Lispy language trying to masquerade as Java. It makes sense that the adopted patterns are more Lispy in nature than they are Java-y, at the end.
@Alesana It doesn't
It used to be the case that the dependency tree was directly represented in the directory tree
But now it flattens the dependencies pretty well
It only nests when two packages as for two incompatible versions of the same package.
@MadaraUchiha That must have been what I saw then
!!urban Gotcha
[ gotcha ] [I understand] what you've communicated
I only use Node.js for Webpack to make static websites
21:29
@Shafizadeh "Got you"
yeah got it now :-)
@Allenph you shouldn't be using OOP in JS to begin with
instead you should go with the functional paradigm
It only just occurred to me that AoC generates a different input for each player.
And now I feel dumb at all the times I went out of my way to censor the answers I've gotten on pastes/screenshots.
@tereško Sorta-kinda
It works rather well with TypeScript
Both paradigms, that is. And both can be used seamlessly in different scenarios.
For example, my view layer is mostly functional, whereas my model layer is mostly OO
@MadaraUchiha well, if JS support is like PHP has in 4.x, then TS support is at 5.0 level
it lacks the features, which forces you into making ugly solutions
@tereško I dunno, what are you missing from TS that you have in PHP?
21:37
classloader
@tereško Like an autoloader?
basically
Meh, all modern editors have an auto import
It's worth saying that TS used to have that
that's not it and you are well aware of it :P
It used to have namespaces and you'd define the scope of the project, and it would load all of the classes in the project at once
But JS went the other way on purpose, and TS made it a design goal to follow suit.
(You can still write projects that way, but it's "not recommended")
@tereško JS simply opted out of weird heuristics when trying to determine what to load what, and instead opted for an explicit module graph
21:40
my exposure to TS has been minimal, so I can only talk about JS
It's a design decision that I don't think has any real implication on your ability to OO.
That's not really why OO is lacking, imho.
it actually has an implication - you can't do polymorphism
@tereško What? Of course you can
all of your dependencies have to be resolved at execution
JS has the best kind of polymorphism, "pray this object has this method" polymorphism :D
And TypeScript has real interfaces.
21:42
and you load all of the classes, that implement that interface, when code gets executed
@tereško You load the ones you care about, yes. But the static nature of import allows you to know everything ahead of time with static anlysis
really, OOP in JS seems to be "round peg, square hole" type of thing
Otherwise, I don't see why it's a big deal
sure you can apply brute force, but functional is a lot better suited
@tereško That it does, although I'll admit to never having figured out why that is, exactly.
I mean, everything is there, the polymorphism, the inheritance, even reflection, and if you add TS, interfaces, abstract, private
21:44
then again, we all know what they say about brute force
@tereško If it doesn't work, you're not having enough of it? :D
@MadaraUchiha "enough of what"? What does "it" refers to ?
@Shafizadeh brute force
ah :-)
@tereško Man, I wish we had this sort of protesting "balls" in Israel.
well, in France it's basically a national sport
Maybe then the government would think on it some more before screwing everyone over for securing their buddies jobs.
@tereško Agree.
Also, yeah. functional is probably better.
Especially when it's event based.
@MadaraUchiha No runtime type system. :D
No true private members...
@Allenph Not required for OO
21:56
Super weird "just grab the value from my parent"-ness.
Meh. This is a circle. You do you bro.
@Allenph Convention works well, also, there's about to be
Oh, don't get me wrong, I don't do lots of OO in JS, I agree that it's awkward
How?
@Allenph class Foo { #bar = 5 }
It's probably the odd toolbox problem, all the tools are there, but they're all slightly off.
Why do they have to use symbols?
Why can't they just write "private" like everyone else?
Also arrow functions seem to be a super weird bandaid.
@Allenph I'm betting it came up
And there's a syntax conflict somewhere
21:58
Hmm.
@tereško Nope, how is it?
good
Also, did you continue with HPMoR?
@tereško I'll have a look, does it have an audio version?
I god close to the end of first book, but got distracted

« first day (2972 days earlier)      last day (2201 days later) »