« first day (1413 days earlier)      last day (3526 days later) » 

12:00 AM
@NikiC hm, wouldn't it make sense to create a class wrapper and use it instead?
 
@BartekBanachewicz That's been a point of discussion as of late
 
@BartekBanachewicz you can do it if you like ... will be very inconvenient to use
 
He already did it...
 
__toString helps there, of course, but it would still be very ugly
nobody does it
 
@DanLugg "as of late"? One would think not having a common way to get lengths of things would be a major problem.
 
12:01 AM
what if we make __toString have to return a string OR an object that implements __toString....
 
@Leigh nice! :)
 
@BartekBanachewicz not sure what's the problem. strlen gets you the length
(the actual problem is stupid people using stupid mb overloads and breaking poor strlen)
 
now that php has an opcode for strlen() it's a bit unfortunate that objects can't take advantage of it =/
 
@NikiC but that's a completely different function doing essentially the same thing
 
I would really love an (ord) typecast, to avoid the fcall overhead, just saying
 
12:03 AM
@BartekBanachewicz strings in php are not char arrays
 
@webarto yeah, more or less what I had in mind. One would think it would get more attention...
 
Unfortunately ^.
 
@Leigh +1
 
they are to a very large part incompatible
 
Anyone happen to have a codesniffer standard i can clone from somewhere that beats you over the head to use mbstring functions? There are some bad habits I still have yet to break completely.
 
12:03 AM
you can't just foreach over a string for example
and strings won't work with any array function
 
@NikiC I want that too
 
@Leigh what do you need ord() for?
 
@Leigh you can do that with UString :D
 
@Leigh Use a break point iterator
 
@NikiC the thing is, when using them I am not interested in what they are. I'd like to get their length, and if we treat them as collections of chars then implementing countable is the way to get the length of a string.
 
12:04 AM
This basically forces you to use intl and actually specify what you want when you iterate the string ;)
 
Pointless discussion is pointless.
 
foreach ($string as &$char) { $char = (chr)((ord)$char ^ $something) }
or whatever
 
@Leigh strings support bitwise ops
common pattern I see
 
@NikiC You're telling me what I can't do things, but not why I can't do them.
 
@BartekBanachewicz No no no. That would make sense, we can't have that.
 
12:05 AM
people always using chr(ord( needlessly
 
@NikiC not properly.
 
interface Encoding {}
class Utf8 implements Encoding {}
class Char<TEncoding is Encoding> { }
class String<TChar is Char<TEncoding is Encoding>> { }
 
^^ Would be so much win.
 
@DaveRandom they support the relevant ones (^&|) properly
 
12:06 AM
@DaveRandom oh well
It was very educational, coming here today.
I never liked PHP so I figured talking with people here is going to be weird and it was quite a number of times.
 
PHP bitwise ops on string returning min(strlen(a), strlen(b)) chars is a feature I like
 
@NikiC shifts are not irrelevant, unless long << bits suddenly became useless and I didn't notice...
 
But talking to you today was a pleasure, and I have a clear understanding that I won't touch anything even remotely related to PHP for the next how-many-I-can years, and that my bashing is absolutely based.
 
@BartekBanachewicz I think it's a rather complicated question. Treating strings as char arrays makes sense in C++, because that's what they actually are there, but in PHP I suspect it would cause more confusion than simplify things.
 
as in, the concept of "completely broken" wasn't just my personal prejudice.
 
12:08 AM
Especially considering that strings are binary in php
 
@BartekBanachewicz Good for you.
 
@NikiC std::string is not a char array. It's an std::string.
 
@NikiC I don't think being able to foreach them would be confusing
 
even the existing array access to strings doesn't treat them as character arrays, it treats them as byte arrays
 
@BartekBanachewicz yes, you make my own case for me
 
12:09 AM
As in internal representation is not the part of its interface and it doesn't influence it
you can still for (char c : string("abc")) { print(c); }
 
@NikiC I'd argue that treating them as a collection of chars makes sense when you bring encoding into the picture. You can always get an array dump of raw bytes.
PHP strings sort of are just byte arrays... no?
 
oh now foreach ($unicode as $codepoint) totally doesn't make sense...
 
@webarto I suppose vOv.
 
@Leigh Why?
 
because bytes are 8 bits bitch :D
 
12:11 AM
foreach ($unicode as $codepoint) or foreach ($unicode->getBytes() as $byte)
 
@DanLugg yes, and encoding is not in the picture as far as php is concerned
 
nice alliteration
 
foreach ($string as $eightBitsPerByteThanks)
 
@NikiC True, but I'd argue that treating them as byte arrays, which they are sort of informally regarded, would make sense too.
 
@BartekBanachewicz Why would you bash, someone wants to force you to use PHP?
 
12:12 AM
@DanLugg It would make sense for some specific cases, but would more likely just cause bugs when people accidentally iterate over a string instead of getting an error
if you want to traverse bytes, foreach (str_split($str)) will do
 
@DanLugg foreach (unicodeGenerator($string) as $codepoint) {} there you go
 
@NikiC I hate catering to the stupid denominator.
 
If you need to traverse something useful, then there's the break iterator
 
@webarto people at my company are trying to use it, so I have to prevent that.
 
which allows you to iterate over code points, extended grapheme clusters, words, whatever
 
12:14 AM
@NikiC you mean IntlBreakIterator? docs aren't clear whether that's in or not yet. Did Saras ICU stuff make it in?
 
@BartekBanachewicz What's the use case, why PHP?
 
@Leigh yes, it's in
since 5.5 or something like that
 
@webarto The use case is irrelevant, really. I can present a superior alternative for every possible case that might arise.
As to "why" - some of the people know bits of it.
 
can't blame people for not knowing about what is essentially a hidden feature - manual is pretty horrible for new stuff
 
@BartekBanachewicz I understand the sentiment, and I don't think it's unjustified, but your process of arriving there is highly unscientific.
 
12:16 AM
I should know, my session_sid stuff never made it to the manual \o/
 
@Leigh commit ref?
 
Basically you latched on to one particular issue (count), which has a number of issues, and extrapolated from there
 
I think it's the attitude that matters.
 
However what you actually found out is that PHP has at least one problem.
 
C++, on the other hand, is perfect
 
12:17 AM
If such an important and basic feature can be so, pardon me, dysfunctional when it comes to one of the most basic data types, then I can only expect worse when getting into more complicated features.
@DaveRandom On the contrary, it's pretty bad.
 
C++17 shows potential, but I suppose it will get to some reasonable level around 2023
 
When someone has a conclusion already decided upon and only looks for evidence that supports it - I don't think they care much about what's "scientific."
 
@derp I didn't really have to look for it in particular.
 
@DaveRandom still looking, PR was github.com/php/php-src/pull/109 - I think arpad took it, bastardeised it, then merged it himself
 
12:19 AM
It's... evident.
 
@BartekBanachewicz strlen(). Tool for job. String model is different, and yeh it has some pretty weird idiosyncrasies, but it does work. It just works in a different way.
@Leigh That'll do, just need the gist of it
(for docs)
 
@DaveRandom What's the reasoning behind not treating strings like every other collection?
 
@BartekBanachewicz Python has in my opinion made a rather bad design choice in the same area
 
@DaveRandom Check it's still there, serial session fondler ohgaki was talking about removing it because it was undocumented
 
namely the have a len() function which can be overloaded by a __len__ method in a class
the proper thing to do would obviously have been to have a len() method
 
12:21 AM
I am not very well versed in python, but metamethods in Lua look similar and they are nice to use.
I think it's mostly because of lack of static type information that such tricks are needed.
 
I personally like C#'s model, sorta. Language constructs that operate on internal interfaces; PHP kinda does that, sometimes, but not as well.
 
@BartekBanachewicz if strlen is your main problem, Javascript could be of use... ''.length... beautiful.
 
@webarto Are we to bring every existing language on the planet to the table now?
 
Rather than __invoke, having class Foo implements Invokable { } where Invokable::invoke(array $args)
 
@BartekBanachewicz Because in PHP strings are not really collections, they are scalars, with an incomplete abstraction that allows you to partially treat them as collections - but if you want them to behave as a collection, use a structure that actually is a collection - there are enough utilities available to let you do this
 
12:24 AM
@DaveRandom So why they "are not really collections"?
 
@BartekBanachewicz Thus my question about the use case. If some people know PHP, that's more important than how to count the string length, IRL.
 
@BartekBanachewicz arrays are hash tables, strings are strings, indexing bytes in strings is not the same as looking up a key in a hash table
 
@webarto I don't want to have to cope with PHP code somday in the future, that's all.
@Leigh Maybe I just prefer the Scheme model of minimal language core, I dunno.
 
@BartekBanachewicz 1.) Make a strong case against PHP, and vote 2.) Get another job
I'm sure 1st would be easier.
 
@webarto I think just making a strong case will be enough.
 
12:26 AM
I'm enjoying Rusts b"string" (it's an array of bytes!)
 
@BartekBanachewicz Because they are scalars. They just happen to have a few abstractions that betray the underlying char * which, for the record, most people actually never use. One thing that you have to remember is that it doesn't make sense for high level web-centric languages to treat strings in the same way as low level languages, because strings are fucking complicated (see C) and web development is basically nothing but incredibly verbose string manipulation.
 
@Leigh how far are you along with the crypto challenges?
 
@Leigh Rust looks interesting alright. I wouldn't force myself to learn another imperative language, though.
 
It's all about use cases
 
@NikiC in PHP, 37.5
 
12:27 AM
@BartekBanachewicz Considering I don't know any other language, making me not use PHP would be very difficult.
 
I started 38 but got bored, I'll pick it up again soon
@NikiC github.com/lt/php-cryptopals not pretty, but not supposed to be, just trying to solve the challenges with scripts, no "pretty" code.
 
@DaveRandom yeah, but that's my point exactly! Because of how important that string manipulation is, limiting it because of internal implementation seems... silly.
@webarto you can simply learn another language. Ever thought about that?
 
@Leigh php 5.6 will be really nice for 40
 
I don't have time and need at the moment. I do wish. It would probably take a year to get to know other language and someone gotta support wife, kid, mistress and Porsche.
 
@DaveRandom and so if you treat strings differently than say, C, why not go full blown and make them a first-class citizens.
 
12:30 AM
we didn't have a gmp root before that ... I had to use some seriously ugly code for that one
 
@BartekBanachewicz It's not limited, it's just different. Converting a string to an actual collection is as simple as $arr = str_split($str)
 
@webarto the more languages you know, the easier is to learn the next one. I don't know (I don't remember! :)) how hard it's to learn the second language. Learning twenty-second certainly takes less than a year though
 
I actually had a test fail for gmp_root today, based on sign
but it was the RC4 checkout
 
But the use cases for treating a string as a collection in web dev are not frequent
 
@Leigh crap
 
12:31 AM
@Leigh do you happen to know which version of PHP create_sid appeared in?
 
@NikiC brb piss, then I'll run tests and work out what it was
@DaveRandom 5.5.1 I think
 
k tnx
 
@DaveRandom interesting PoV
 
@Leigh not sure what could be wrong there. it just does some error checking and passes on to mpz_root
 
@DaveRandom I don't get why it's different, though. There's no problem in making strings proper collections and allowing string-specific mechanics. At least none that I know of, assuming you properly abstract the low-level details.
 
12:33 AM
@BartekBanachewicz I know Ruby a bit (can't type it), and from what I've seen, it has probably more 1337 syntax, and is more saner in parts than PHP, but still I see no benefit in using it exclusively, PHP is more fun.
Talking purely web-related.
 
@BartekBanachewicz PHP is a little red wagon, that's now being used as an international courier service; it's warty.
That's why some of the abstractions are... y'know.
 
@DanLugg What you're basically saying is that the language sucks but you're still using it because you're too lazy to kill it and switch to something else / legacy. Did I understand it right?
 
@BartekBanachewicz No, I use it because money. So, following your assertion, I use it because I'm too lazy to make money doing something else.
 
@webarto maybe try a language that makes a bigger paradigm shift.
 
12:35 AM
@BartekBanachewicz what @DanLugg said. PHP is full of horrible, weird, leaky abstractions. But we do know that and are doing something about it - it's not a quick process though (otherwise you end up with Python 3/perl 6 scenarios)
 
@DanLugg there.
 
067+     string(3) "-36"
067-     string(2) "36"
 
Mind you, I C#/Ruby 9 to 5.
 
@NikiC sorry pasted that from laptop, test 041.diff under ext/gmp
 
12:37 AM
@Leigh is that for root or remroot?
 
I am a bit spoiled since I had / have the luxury to pick a job where code is written the way I like it to.
 
well the test doesn't specify
 
@BartekBanachewicz I like C#, so I suppose I'm in a similar boat. I hate .NET, but I love C#.
 
^ this
 
But TBH if I were forced to write PHP just for the money... I wouldn't be passionate enough about my job to do it properly. I'd rather work at Starbucks, I think (I love coffee).
 
12:38 AM
@Leigh Probably the gmp_rootrem(-100, 3) one
that one has a compat implementation for ANCIENT versions of gmp
 
@BartekBanachewicz Once you reach a point where you've catalogued the PHP corner-cases to know them, it's not a terrible language.
 
probably has some bug with the signs
 
But that does take time, and we've all probably been exactly where you're standing now, on this topic; though maybe with less experience in other languages (which is why we were naive enough to stay)
 
im using debian unstable on my laptop, hope its not ancient gmp
 
@DanLugg Terrible is subjective, and to be honest, knowing this handful of languages I do more or less fluently, the only language that I'd say is worse is C.
 
12:40 AM
@BartekBanachewicz Eh. PHP is a shitty C abstraction.
 
C has no abstraction and no way to create one :F
 
javascript is worse. I bloody hate javascript. but hey, ya gotta get stuff done somehow.
ya take from the language what it offers and deal with it.
 
@derp I think it's really better than PHP. It's certainly more modern, it's more performant, and has the APIs to everything nowadays. And npm is great.
 
@derp Meh, prototypical inheritance is neat.
 
@derp Or pick a different language.
 
12:42 AM
@BartekBanachewicz Not when you work for a Microsoft licensed shop. If I hated C# enough to use VB (which I'd hate because I do) then I'd have to get a new job.
 
Also ES7 is showing amazing future I'd say.
@DanLugg what about F#?
 
Same can be said of any language. You don't walk into a Drupal shop and say "FUCK THIS SHIT GUYS WTF WHERES THE RAILS!?"
 
I wouldn't say that generalizing to "any language" is fair, TBH.
 
@BartekBanachewicz Yea, and the rest of us in the real world can't just get to tell our bosses that time-to-market doesn't matter while we learn new <insert-language-of-the-month-here>
 
Right, it's got some neat things. So I enjoy those bits that are neat (though I don't much like prototypical inheritance.) All a matter of preference.
 
12:43 AM
@BartekBanachewicz Well, there's assembly interop, and then there's communication with co-workers. If I hate C#, I probably don't want to work with C# devs on either side of me when we're all staring at parts of the same project.
@BartekBanachewicz Well, my point is that most any language, that you despise; chances are you don't want to work in a shop that deals exclusively in that.
 
@DanLugg fair enough
 
Hell, I could write Boo, or even PHP! It can compile to IL.
 
@DanLugg okay, fair enough #2.
oh right forgot about Boo
 
lol Boo sucks.
 
I remember Boo for having impressive metaprogramming
I've never written anything in it though
 
12:45 AM
I vaguely recall that too, but I really only toyed with it.
Yea, same.
 
@Leigh will have to figure our what's happening there tomorrow, I'm going to sleep now...
 
@ircmaxell ND filter?
 
@DanLugg yeah so I wouldn't say it sucks before using it. It looks like a really advanced language.
 
@NikiC Gute Nacht!
 
12:47 AM
@webarto one was with a 10-stop ND filter
 
@BartekBanachewicz I know, I was being drunk and facetious, but it wasn't really something I enjoyed IIRC>
 
the other long exposure was infrared :-D
 
@cspray technological debt is a thing though
 
@ircmaxell Thus me not writing ND8 :P Awesome.
 
@NikiC n8 ;) yes definitely remroot, and I have libgmpxx4ldbl installed, whatever the fack that is
 
12:47 AM
@BartekBanachewicz I agree and totally understand that
But it is possible to write good PHP code
Believe it or not
 
@cspray Yea, you write band-aids to put over the language warts.
 
Can I be janitor in Google?
 
And I also agree that if you have 2-3 people that know PHP and you need a website built the last thing you want to do is say "Let's swap to Ruby guys!"
 
@ircmaxell have you slimmed down more since last year, looking trim, could be the light of course
 
@DanLugg Perhaps.
 
12:49 AM
Guys! After this beer, and the next beer, I only have 4 beers left!!
WAT DO I DO
 
drink wine
 
I guess I just don't buy into the whole "impossible to write maintainable code in PHP"
 
I don't think I have any
 
@DanLugg drink urine
 
vodka?
 
12:49 AM
I have a lot of vodka, but I don't wanna get into that.
 
@Leigh light and perspective mostly ;-)
 
Or that swapping to another language will magically make the dev just suddenly start writing maintainable code
 
@cspray It's also substantially harder than doing so in other languages, IMHO.
 
Just because they swapped languages
 
@BartekBanachewicz Not when the devs are more proficient in PHP.
 
12:51 AM
If you can't write reasonably maintainable code in PHP why in the world would I expect you to start doing so just because you're using Ruby/C#/Whatever?
 
well, yes, training costs are also a thing
 
If I have a room full of Ruby devs, I'm not going to force them to write PHP, likewise of the inverse. More importantly, I'd be a bit scared as a PM if I knew they were going to attempt that.
 
@cspray How do they say... you can write Java in any language? :P
 
@cspray because in PHP you have to compensate for the language flaws to a much bigger extent
 
PHP has no major flaws per se.
9
To get shit done.
 
12:52 AM
PER. SE.
 
@DanLugg my point is that in the long run it's probably better to switch to some other language, paying the temporary training cost.
 
I don't even know what that means.
per second?
 
@BartekBanachewicz Also, not necessarily. A lot of common web tech is PHP. Interop is likely more valuable.
 
@webarto you really shouldn't produce such statements after openly admitting that it's the only language you know.
@DanLugg A lot of crappy common web tech vOv.
 
Doesn't mean that business isn't done with it.
 
12:53 AM
of course not
 
@webarto lolwut
 
Bottom line, bottom dollar.
 
but the industry top-grade is hardly php nowadays
 
Well there's a lot less at the top than there is at the bottom.,
Pyramid my friend.
 
@BartekBanachewicz Only one that I can say I know with some amount of certainty.
 
12:54 AM
@DanLugg I mean % not sheer quantity
 
And I mean quantity.
 
@webarto Well, then with some amount of certainty you're certainly wrong.
 
@ircmaxell Language flaws? Compared to what? Who cares?
 
@webarto compared to ... oh wait you don't know anything you can compare to.
 
@webarto I only starred that because A) you're ridiculous, and B) "per se".
 
12:55 AM
@webarto there are a lot of positive things I'd say about PHP. You know that. But "has no major flaws" is not one of them :-)
 
Why the fuck are you all using it then?
 
Language arguments are just goddamn silly. Everything you're trying to do has parameters that you're trying to fit together as best you can. From the schedule to the budget to the available tools and packages to the skillsets of the existing team, and so on. If you're going to hold that all up to throw a fit over a language, grow up.
 
@DanLugg point being there's a lot of crappy code being written in PHP and it's not being chosen for the company making top-quality software that often
 
It won't get fixed in your lifetime.
 
@webarto I haven't used it for past 7 years.
 
12:56 AM
@webarto because the flaws are outweighed by the strengths
 
Even if it get to live that long.
 
@BartekBanachewicz are you just here to troll?
 
of course not.
 
Nah, it's been a legit convo.
 
Or a very elaborate, elegant troll.
 
12:57 AM
^^
 
@ircmaxell Flaws in sense that I don't care if it's strlen($string) or $str->length() or whatever...
 
no, not those flaws
 
I like language debates, sue me. :P
 
Well, so far we've established that PHP is awful because strings aren't an array of characters and you haven't used it in 7 years ;)
 
12:57 AM
@ircmaxell That's the topic of discussion for the last hour or so...
 
flaws as in fubar inconsistent casting rules for scalars that differ in how they are applied depending on context
 
@cspray don't forget the count() thing :p
 
A few minutes ago you mentioned not judging Boo because you hadn't used it... perhaps the same is warranted for PHP?
 
@cspray I haven't used Boo ever in my life. I was using PHP for about 2.5 years before I stopped around 6 or 7 years ago
 
I'm saying this fully aware of a lot of PHP's flaws and I make my living using other languages :)
@BartekBanachewicz PHP has changed a lot in that time
 
12:59 AM
@ircmaxell We all know it sucks but we learned to live with it and some try to fix it.
 
You're all wrong, Brainfuck is the only language you need to know.
 
It would be entirely unfair to compare most languages as to how it was almost a decade ago
 
C?
 

« first day (1413 days earlier)      last day (3526 days later) »